Let's say I have the following class:
public class Immortal
{
private static System.Collections.ArrayList immortals = new System.Collections.ArrayList();
public Immortal()
{
}
~Immortal()
{
// rise from your grave!
immortals.Add(this);
System.Gc.ReRegisterForFinalize(this);
}
}
If I then do the following:
Immortal being = new Immortal();
being = null;
System.GC.WaitForPendingFinalizers();
Will the program hang waiting for an immortal object to die?
I know that the docs don't guarantee that WaitForPendingFinalizers will ever return, but I'm just curious if this will hang it.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.