[Gc] Re: Understanding why GC'ing increases to the double in time?

Hans Boehm Hans.Boehm at hp.com
Mon Feb 13 08:35:39 PST 2006



On Thu, 9 Feb 2006, Martin Egholm Nielsen wrote:

> Would it be possible (with a reasonable amount of hacking, that is), to
> measure the time spent in "mark_from" (if this is where time is spent),
> and then return if more than X ms has passed, and the resume from that
> point(er) the next time there is time. And perhaps to make a full
> collect every 20'th time.
> In order not to spent all the time looking up time-spent, this could be
> flavoured with a couple of training runs perhaps learning how many
> cycles of the for-loops can be finished before actually checking
> time-spent...
>
> I know this is an extreme embedded-tailoring of the GC, but is it at all
> possible to do?
> Perhaps it would never work since the "reference counting" phase will
> never complete, hence not knowing if any segment can be released...
>
Actually, the collector's incremental mode is similar to this.
The difficulty is that when you stop marking and let the client run
for a while, you end up with marked objects no longer on the mark stack
pointing to unmarked objects, which then get missed by the marker
altogether and reclaimed prematurely.  Just restarting the marker
after a while is not correct.

To handle this correctly, you need some way of tracking data structure
changes made by the client.  The incremental collector does this by
tracking written (dirty) pages.

An alternative is to just start over and drop the previous marking work
when the client code needs cycles.  That's also already supported, but
only works if the client resularly has enough idle time to allow the GC
to complete.

Hans


More information about the Gc mailing list