I'm creating a bunch of objects and need to use these object pointers with C code. Hence I need to protect them from being GC with GC.addRoot.

Can this call be made out of a constructor? So that I can protect the objects as earyl as possible?

Could I then unprotect the memory inside the destructor, which I would call explicitly via destroy(...)? Or would a call to destroy be sufficient to tell the GC, now you can collect the memory?

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

  • Can I call GC.addRoot from co... Robert M. Münch via Digitalmars-d-learn

Reply via email to