[Gd-hackers] Suggested patch for Open Dylan's C runtime

Thomas Christian Chust chust at web.de
Thu Aug 2 12:15:09 CEST 2007


Bruce Hoult wrote:
> On 8/1/07, Thomas Christian Chust <chust at web.de> wrote:
>> Bruce Hoult wrote:
>>> Right. :-)  Looks good provided that link object won't get GC'd in the meantime.
>> But if that happened, I would consider it a bug in the garbage
>> collector. I my eyes, being the fixed parameter to a registered callback
>> fully qualifies an object as being alive.
> 
> I agree.  My point is only that it's probably better to check that
> this bug does not exist now, while you're thinking of it, than for
> someone find it by accident later when it might take many hours to
> figure out what is going on.

Well, all I can say is that the patch works fine on my Mac when I create
a large bunch of small transient objects registering for finalization in
their initialize method and draining the finalization queue either
afterwards or in the initialize method as well. I think that if there
were such a bug, it should show up in this situation -- if the test
objects are marked for collection, it is pretty likely that some of the
unused queue nodes should be marked too, if they were not considered
alive any longer.

Also the documentation of the Boehm garbage collector states in the
documentation for GC_register_finalizer_ignore_self and _no_order: "Note
that cd [the data argument for the registered finalizer] will still be
viewed as accessible, even if it refers to the object itself." I think
this confirms that the data argument is always stored somewhere
reachable from a GC root.

However I don't feel like digging into the garbage collector source and
checking if the assumption that this works as it should can rigorously
be proven.

cu,
Thomas




More information about the hackers mailing list