Thought on limiting scope of GC

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Feb 14 06:23:39 PST 2014


On 2/14/14, 3:28 AM, Jerry wrote:
> Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> writes:
>> Yah, it's a classic (with the manes "track" -> "mark" and "cleanup" ->
>> "sweep"). Allocators support that already, and installing a global GC should
>> do as well.
>
> I don't follow the global GC comment.  Let's say you're using global GC
> in general but want to control more tightly what it's doing at a
> particular region of the code.
>
> Mark looks at all things that have been allocated and possibly live.

Oh, I think mark/sweep in the "mark/sweep idiom" are different from 
"mark & sweep garbage collector". I looked for the evidence that the 
idiom does exist under that name, but apparently I was wrong.

Anyhow, I guess track/cleanup is less confusing.

> Track says keep track of objects allocated after the track call, and
> cleanup only looks at those objects that were recently allocated,
> ignoring the rest of the heap.
>
> If you're saying that allocators will provide the means of doing this,
> then that's fine.

I'm thinking of something like:

MyAllocator alloc = ...;
alloc.installGlobally();
...
alloc.deallocateAll();
alloc.uninstallGlobally();



Andrei



More information about the Digitalmars-d mailing list