Disabling the Garbage Collector
Jeroen Bollen
jbinero at gmail.com
Mon Mar 3 04:23:47 PST 2014
On Monday, 3 March 2014 at 02:33:49 UTC, Adam D. Ruppe wrote:
> On Sunday, 2 March 2014 at 23:21:49 UTC, Jeroen Bollen wrote:
>> Is there maybe a way to disable the garbage collector from
>> running unless you explicitly call it?
>
> That's really the default. The GC in D runs if and only if you
> do a GC allocation and there isn't enough memory in its
> existing pool. Then it tries to do a collection to make room
> (and if that fails, it asks the operating system for more
> memory to grow its arena, and if that fails, it throws
> OutOfMemoryError).
>
> If you call GC.disable, it just sets a flag to skip the try
> collection step.
>
>
> But, in any case, the GC doesn't sit around in the background
> constantly running at random times. It only runs when you call
> on it to allocate.
If I were to compile without linking to the garbage collector,
what would and what wouldn't work in D?
More information about the Digitalmars-d-learn
mailing list