Mem Mgmt: With & Without the GC
Cauterite via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 21 10:05:45 PDT 2016
On Sunday, 21 August 2016 at 16:14:53 UTC, Zane wrote:
> 5) Is there a way to do simple heap allocation with 'new' while
> ensuring the GC doesn't deallocate until I want it to?
While my earlier suggestion of using malloc/emplace is one
option, another is to use `GC.addRoot(objPtr)`. It ensures the
object is never deallocated until you call
`GC.removeRoot(objPtr)`.
More information about the Digitalmars-d-learn
mailing list