How do you deal with scoped allocations?

thedeemon dlang at thedeemon.com
Mon Dec 9 02:35:06 PST 2013


On Monday, 9 December 2013 at 09:13:20 UTC, John Colvin wrote:

> P.S. does anyone know how the GC interacts with core.stdc.free? 
> I.e. if you free a pointer, but don't null the pointer, 
> presumably the GC will still scan the memory despite it being 
> freed. Isn't this undefined behaviour?

 From what I understand, if you malloc a buffer it lies outside 
GC's managed heap, so a pointer to this place will not be 
followed during GC scan. Unless you explicitly told it to, by 
calling GC.addRange().


More information about the Digitalmars-d mailing list