[Gc] Patch for GC_debug_register_finalizer
ivmai at mail.ru
Wed Aug 12 01:20:24 PDT 2009
This small patch corrects two issues in GC_debug_register_finalizer() (and friends):
- return 0 for old fn and client_data if obj doesn't belong to the GC heap (like "normal" GC_register_finalizer() does);
- if not enough memory to register a new finalizer (and GC_oom_fn hasn't helped) then don't modify (clear) the values pointed by ofn and ocd (for the "normal" GC_register_finalizer() this behavior is enforced by another my old patch diff62: https://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2579).
* dbg_mlc.c (OFN_UNSET): New macro (to detect
* dbg_mlc.c (store_old): Add a check for register_finalizer()
failure caused by an out-of-memory event (leave *ofn and *ocd
unmodified in that case).
* dbg_mlc.c (GC_debug_register_finalizer,
GC_debug_register_finalizer_ignore_self): Initialize my_old_fn
to OFN_UNSET; clear *ocd and *ofn for non-heap objects (the same
as in GC_register_finalizer_inner()).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3123 bytes
Desc: not available
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20090812/9d1ec61a/diff117.obj
More information about the Gc