I have read many articles how finalizer works. Here is my understanding: If a class have finalize method implemented Jvm would create an instance of Finalizer as a watch dog on that object.
When GC runs it would mark object to be disposed and add them into the reference queue then finalizer thread would pick those objects from the queue and execute their finalize method.
My question is: How do I find the object from the heap dump whose finalize method wasn't completed for some reason and started piling up the reference queue?
Is reference queue in a specific order?
finalize()
- are there too many candidates in your codebase? – Jugglejava.lang.ref.Reference
class and nestedReferenceHandler
class. GC only adds references to static fieldpending
. All other job is doing in java code in Reference Handler and Finalizer threads – Reprieve