Robert Buck wrote in post #1085583:
> It was my assumption that during shutdown the objects would be freed
> leaf objects first, and a mark and sweep like approach. It seems however
> that Ruby just walks an object table and frees each in entry order.
>
> For native (C/C++) object graphs this can lead to out of order
> deallocations. In my particular case this leads to a SEGV.

Hi,

If you have to free the objects in certain order, in C/C++ you have to
record only one Ruby object which is the root, then you create pointers
to all other leaf (non-root) Ruby objects; in the free function
pointers, you set all the leaf (non-root) Ruby objects as NULL.
Hopefully you don't create too many temporary leaf (non-root) objects,
as all we be freed only when root is freed.

Regards,

Bill

-- 
Posted via http://www.ruby-forum.com/.