Do AAs allocate on removal?

thedeemon dlang at thedeemon.com
Sat Dec 7 10:07:38 PST 2013


On Saturday, 7 December 2013 at 15:58:08 UTC, Gerrit Wichert 
wrote:
> I suspect that the AA reorganized (with allocation) when an 
> element is removed. I think it is a good idee if this can be 
> delayed until the next insert, so that remove can be used in 
> finalizers.

A quick glance into the source shows that removing an entry does 
not allocate, but calls GC.free(). Inserting an entry does 
allocate. Rehashing happens when entries are added, not when they 
are removed.

Check your destructors again, make sure they are not called twice.


More information about the Digitalmars-d mailing list