[Gc] Re: Mentality of c/c++ programmers when it comes to gc
hans.boehm at hp.com
Wed Jan 2 15:02:18 PST 2008
> From: gc-bounces at napali.hpl.hp.com
> I haven't migrated to 7.0 yet, so my knowledge may be obsolete.
> In 6.x, certainly there seems no public way to do that---if I
> ever need one, I'd probably just go into the source and add
> it (internally, there's GC_start_call_back.)
> Such API would be a nice addition, but I guess the semantics
> is not simple: For incremental collections do you want
> callbacks for every chunk of mark phases, or just a full
> collection? Do you need the beginning callback and the end
> callback called the exact timings (in which case there'll be
> severe limitations in what you can do within callbacks, for
> they must be called while the lock is held) or can it be
> looser (e.g. you can allow beginning callback to be called
> twice before end callback
> is called)? I can't think of a single nice API. However,
> I'm no expert of GC; maybe somebody in this list may have a
> clear answer.
Agreed on both counts: This would be nice to have and it's hard to get it right. This also came up in some past discussion in the context of supporting custom finalization schemes that do not require the collector to allocate auxilliary memory for objects registered for finalization.
Another big problem with GC callbacks is that it's unclear what they should be allowed to do. If they run inside the collector, they must be serverely restricted. If they run completely outside, other allocations can intervene between the callback and the GC.
More information about the Gc