On Tuesday, 16 July 2013 at 18:21:05 UTC, Jonathan A Dunlap wrote:
You can also make use of library types for reference counting,

http://dlang.org/phobos/std_typecons.html#.RefCounted

And if you really, really need, also manual memory management by calling the C functions and letting the GC know not to track that memory.

http://dlang.org/phobos/core_memory.html#.GC.BlkAttr.NO_SCAN

Fascinating! I assume the Phobos RefCounted then avoids using the GC by utilizing GC.malloc (NO_SCAN) behind the scenes? Has anyone benchmarked an application using D's GC versus using RefCounted for critical paths?

I highly advice not to use the NO_SCAN unless you really know what you are doing. Not that the GC will trigger only when enough memory is allocated, so if you deallocate most memory manually, the GC won't trigger often.

Reply via email to