One possibility would be to use the Kernel.at_exit() method to =
explicitly register your library cleanup functions.
This only works if your problem is a final cleanup, not a per-object =
cleanup.

Bye, Oli

-----Original Message-----
From: Charlie Savage [mailto:cfis / savagexi.com]=20
Sent: Wednesday, July 09, 2008 8:41 PM
To: ruby-core / ruby-lang.org
Subject: [ruby-core:17706] Re: Mark functions not called on exit



Nobuyoshi Nakada wrote:
> Hi,
>=20
> At Wed, 9 Jul 2008 17:30:14 +0900,
> Charlie Savage wrote in [ruby-core:17694]:
>> When the process terminates, Ruby sometimes frees the document object =

>> before the nodes object, thereby causing a segmentation fault.
>=20
> The order is not guaranteed in any sense.
>=20
>> So - is my observation correct that mark functions are not run at =
exit?=20
>=20
> No, it's not an issue of the mark functions.  The free function must=20
> not assume the order, nor rely on other objects.

Hmm.  To correctly shut down my extension, I do need to control the =
order in which the objects are freed.  Is there any way to do this?  And =
have other people run into this issue (seems like it would be common =
when freeing resources allocated from a 3rd party library, in this case =
libxml).

Charlie