Manual Deletion from Destructor

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Mar 14 11:26:02 PDT 2009


Sean Kelly wrote:
> Andrei Alexandrescu wrote:
>>
>> You can't call delete against a struct object, so the above wouldn't 
>> compile. What may solve your problem is calling GC.hasNoPointers 
>> against the block of memory in which hugeDataStructure lives. But 
>> before that... isn't the current GC non-conservative for 
>> heap-allocated objects? I thought it's only conservative for stack 
>> objects.
> 
> It's conservative for everything, unless you count marking an entire 
> block as "has pointers" non-conservative.  The GC currently doesn't know 
> where in a block the pointers are, so it treats all such labeled blocks 
> conservatively.

Ouch. Yet another place where introspection could help lots.

Any statistics about the amount of slack memory due to false pointers 
would be appreciated.


Andrei



More information about the Digitalmars-d mailing list