When does GC run?
rikki cattermole
rikki at cattermole.co.nz
Tue Oct 16 09:44:56 UTC 2018
On 16/10/2018 10:38 PM, John Burton wrote:
> Is there any documentation or information about the specifics of the
> garbage collector?
>
> The information I have found indicates that it runs to free memory when
> the system runs out of memory to allocate. But will this try to use all
> the system memory or some other amount before trying to garbage collect?
> If I have a _lot_ of garbage, will it try to collect that before
> allocating any more system memory? Is this configurable in any way?
>
> Any information or just pointer to information that I've somehow failed
> to find would be appreciated.
It is based upon how much is currently free and is not configurable.
The GC of course doesn't just use all the system resources that would be
stupid. It will collect long before that either when you tell it to
(core.memory GC.collect) or when you do an allocation and it is enabled.
GC series on the D blog: https://dlang.org/blog/the-gc-series/
More information about the Digitalmars-d-learn
mailing list