Disable GC entirely

Peter Alexander peter.alexander.au at gmail.com
Sat Apr 6 02:51:16 PDT 2013


On Saturday, 6 April 2013 at 04:16:13 UTC, Adrian Mercieca wrote:
> Hi,
>
> Is it possible to switch off the GC entirely in D?
> Can the GC be switched off completely - including within phobos?
>
> What I am looking for is absolute control over memory 
> management.
> I've done some tests with GC on and GC off and the performance 
> with GC is
> not good enough for my requirements.

You can switch off the GC, but then things will leak as the core 
language, druntime, and phobos all use the GC is many cases.

What I do is just avoid the functions that allocate, and rewrite 
the ones I need. I also use a modified druntime that prints 
callstacks when a GC allocation occurs, so I know if it happens 
by accident.


More information about the Digitalmars-d mailing list