> __________ __________ > Objects in | | | | > GC-managed | SMOB 1 | | SMOB 2 | > heap |__________| |__________| > | ^ | ^ > .....................|...|.........................|...|.......... > __v___|___ _________ __v___|___ > Objects in | | | STL | | | > normal heap |C++ object|--->|container|-->|C++ object| > (not scanned |__________| |_________| |__________| > by GC)
> The SMOB finalizers free the associated C++ objects below them. Now, > suppose that none of the objects above are reachable, so both SMOBs are > queued for finalization. Now suppose that SMOB 2 is finalized first, > thus freeing the C++ object below it. It's clearly wrong for SMOB2's finalizer to free its C++ object here since that object is still reachable from C++ objects. Stefan