D garbage collector and real-time systems

Mike via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 00:12:23 PST 2015


On Wednesday, 28 January 2015 at 06:58:42 UTC, Tom wrote:
>
> Or is there now the possibility of disabling the GC altogether,
> or replacing it with a refcounting 'GC' etc?

You can disable the GC:  
http://dlang.org/phobos/core_memory.html#.GC.disable

There is a RefCounted struct in the standard library: 
http://dlang.org/phobos/std_typecons.html#.RefCounted
But, last I heard there were some problems with it:  
http://forum.dlang.org/post/cakobtxrmvrpqhswmfsy@forum.dlang.org

I suggest reading this article: 
http://wiki.dlang.org/Memory_Management.  It provides more 
information and working examples illustrating some techniques for 
avoiding the garbage collector.

Note that D has 3 built-in types: exceptions, dynamic arrays, and 
associative arrays, that may be difficult to use without the GC:  
http://dlang.org/builtin.html.

Mike


More information about the Digitalmars-d mailing list