[Gc] Patch for GC_debug_register_finalizer

Ivan Maidanski ivmai at mail.ru
Wed Aug 12 01:20:24 PDT 2009


Hi!

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: http://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2579).

ChangeLog entries:

	* dbg_mlc.c (OFN_UNSET): New macro (to detect
	GC_register_finalizer() failures).
	* 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_no_order,
	GC_debug_register_finalizer_unreachable,
	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()).

Bye.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff117
Type: application/octet-stream
Size: 3123 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20090812/9d1ec61a/diff117.obj


More information about the Gc mailing list