D needs emplacement new

Namespace via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 27 04:47:45 PDT 2015


Since nobody wants to take that work, can at least someone 
explain me what is going on if I don't reinitialize the memorY?
I create 1000 Foo's 1000 times. After the first iteration there 
are 1000 unused Foo objects and the GC wants to reallocate 
another 1000 Foo's. Now, what happen? The GC sees that the 
previous 1000 objects are unused, remove them and allocate new 
and fresh memory for the current 1000 Foo's? Or does the GC see 
1000 unused Foo's and reuse the memory? How can I observe if the 
later is true? If I store the pointer to the object to compare 
them, the GC will recognize that and will not finalize the object.


More information about the Digitalmars-d mailing list