Destructor/Finalizer Guarantees
    thedeemon via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Nov 12 03:50:30 PST 2014
    
    
  
On Wednesday, 12 November 2014 at 04:06:11 UTC, Algo wrote:
> Could this work?
>
> class VM {
>     static List[VM*] _gcRootLists;
>     List* gcRootList;
>     ~this() {
>         _gcRootLists.remove(&this);
No. Hash-table operations may try to allocate or free memory 
which is not allowed during a GC cycle where the destructors are 
called. It will just cause InvalidMemoryOperationError and the 
program will exit abnormally.
    
    
More information about the Digitalmars-d-learn
mailing list