Non-freeing GC memory management

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 17 12:29:27 PST 2015


On Tue, 17 Nov 2015 19:32:03 +0000, Adam D. Ruppe wrote:

> On Tuesday, 17 November 2015 at 19:27:15 UTC, tcak wrote:
>> As far as I know, GC has a separate thread that stops all other threads
>> periodically to clear the unused memory fields.
> 
> That is a common misconception...
> 
>> What disadvantages would we have if GC was to be freeing memory only
>> when allocation is requested, and not checking periodically?
> 
> This is what it actually does now.

And, as I understand it, it will only trigger a collection if it doesn't 
already have any free memory of the correct size. There might be 
something else to ensure the collector doesn't run too often.


More information about the Digitalmars-d mailing list