My application uses a third-party library (JTDS driver), in which there are some objects that override the finalize () method. I think that they obey all the rules about when not to use finalize()- it does not depend on whether they work on time or in general.
The problem is that objects are never released. They seem to get stuck in the Finalizer queue and are never deleted. They grow slowly over several weeks and run the JVM from the heap. Thread dumps show a Finalizer thread waiting for something to call finalize()on. If I call System.runFinalization(), the objects will be finalized and correctly removed from the finalizer queue (and will no longer appear in heap heaps).
Why System.runFinalization()does it delete objects correctly, but the Finalizer thread will not do it on its own?
Jason source
share