|
|
> Btw, could you finally give me even a slight hint at how GC knows
> that an object is not used anylonger?
>
> I don't get it.
You mark every object that exists as "garbage". Then you take each
global variable, local variable in currently running threads, etc. in
turn, and you mark the object that variable points to as "not garbage".
And then you find every object it points to and mark all those as "not
garbage". And then all the objects that *those* objects point to, and so
forth. Follow all the pointers until you stop finding objects that
aren't already marked.
At this point, anything still marked "garbage" gets deleted.
Simple, really. And slow. And various optimisations make it go much faster.
Post a reply to this message
|
|