Frits van Bommel wrote:
Daniel Keep wrote:
Frits van Bommel wrote:
Daniel Keep wrote:
When your class' dtor is called, you CANNOT say whether any of the
references into GC-controlled memory you hold are still valid.
You forgot to add: unless you know for a *fact* they're referenced from
a GC root, for example from a global variable (directly or indirectly).
Or there's an integer somewhere that LOOKS like a pointer to it ... I
was talking from the perspective of NOT having any information outside
of the object itself. :P
No, you can't assume this one. For all you know, your program might one
day be compiled with a (semi-)precise GC :).
I could read the sources till I become an expert on this, but maybe it's
more efficient, if somebody thoroughly explains to us, what is really
going on when we have an object that has pointers to other instances,
and it's time to collect it.
Using only two objects, adam and eve. Intially I have a reference to
adam, and adam has a reference to eve. And what I'd of course wish, is
that eve be destructed before adam, or at least that both's destructors
would be run, no matter what. Let's say each has a file to close.
So, does /anybody/ know this so well that the explanation ends up being
clear, concise, and unambiguous.