www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Make GC.free a no-op during a collection cycle?

Several discussions (including the recent one on RCSlice) mentioned the 
fact that calling GC.free inside a destructor may lead to double freeing 
of memory.

One simple solution is to simply have GC.free return immediately if 
called inside a collection. Nothing good could come of the call anyway.

Would this work? Any impediments?


Andrei
Feb 25 2015