J
Joona I Palaste
The recent messages about finalize() got me thinking about this...
I got the impression that when the GC sweeps up an object, it calls its
finalize() method. Now if this is true, what happens if the finalize()
method of an object adds a reference to that object to some other live
object? I find three possible outcomes:
(1) The original object won't be swept up after all,
(2) The reference will end up being a zombie, accessing which will
either throw an exception or cause an error in the whole VM, or
(3) Such a thing is forbidden entirely.
Which is it? Or am I wrong altogether about the GC calling finalize()?
--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"A friend of mine is into Voodoo Acupuncture. You don't have to go into her
office. You'll just be walking down the street and... ohh, that's much better!"
- Stephen Wright
I got the impression that when the GC sweeps up an object, it calls its
finalize() method. Now if this is true, what happens if the finalize()
method of an object adds a reference to that object to some other live
object? I find three possible outcomes:
(1) The original object won't be swept up after all,
(2) The reference will end up being a zombie, accessing which will
either throw an exception or cause an error in the whole VM, or
(3) Such a thing is forbidden entirely.
Which is it? Or am I wrong altogether about the GC calling finalize()?
--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"A friend of mine is into Voodoo Acupuncture. You don't have to go into her
office. You'll just be walking down the street and... ohh, that's much better!"
- Stephen Wright