GC allocation issue

Adam D. Ruppe destructionator at gmail.com
Thu Mar 20 18:08:32 PDT 2014


On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
> I tried using emplace but the copy gets deleted by the GC. Any 
> idea why?

That's extremely unlikely, the GC doesn't know how to free 
manually allocated things. Are you sure that's where the crash 
happens?

Taking a really quick look at your code, this line raises a red 
flag:
https://github.com/globecsys/cache.d/blob/master/chd/table.d#L55

Class destructors in D aren't allowed to reference GC allocated 
memory through their members. Accessing that string in the dtor 
could be a problem that goes away with GC.disable too.


More information about the Digitalmars-d-learn mailing list