On Sunday, 21 August 2016 at 19:30:51 UTC, Guillaume Piolat 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?

Keep a reference somewhere reachable (by default: stack, heap, globals: everything is reachable and scanned).


Or just tell the GC directly not to collect it via GC.addRoot:

https://dlang.org/phobos/core_memory.html#.GC.addRoot

Reply via email to