[Gc] Setter and getter for GC_start_call_back
hans.boehm at hp.com
Thu Mar 25 16:20:59 PST 2010
I think this patch is fine. But this is a really tricky interface to use correctly, and it would be good to say a bit more, like "Unless you really understand the collector internals, the callback should not, directly or indirectly, make any GC_ or potentially blocking calls. In particular, it is not safe to allocate memory using the garbage collector from within the callback function." It might also be good to move the GC_notify_full_gc() in up a couple of lines to before the GC_clear_marks() call. That way the mark bits are in a similar state for both calls.
> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ivan Maidanski
> Sent: Friday, March 12, 2010 12:58 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Setter and getter for GC_start_call_back
> I've added a setter and a getter for GC_start_call_back
> notifier to API (I've put them to gc_mark.h instead of gc.h
> just not to bloat the latter). I've also removed a check for
> stop_func == GC_never_stop_func in GC_try_to_collect_inner()
> when calling GC_start_call_back (because
> GC_try_to_collect_inner() always initiates a full GC).
> PS. GC_start_call_back could be used, e.g., for SoftReference
> processing (turning aged ones into weak ones).
More information about the Gc