If suppose an object implements the Finalize method but inside it refers an alive static object of the application (bad design! but very possible).
Now when GC kicks in and finalises the object by putting it in Finalization queue and then move it to FReachable queue where it would call its finalize method.
But whoa! it finds its referring an alive object so it doesnt allow GC to reclaim the memory occupied by the object and marks the object alive again. A zombie object!
At this point where does this object reside?
- Remains in freachable?
- Remains in Finalization queue?
- Remains on managed heap in an indeterminate state (removed from freachable and finalization queues)?
Also what can be the best place to ReRegisterForFinalize() for such object?