Java Memory issue : Java.lang.ref.finalizer object

1.2k views Asked by At

In most of the research about the memory leak caused by finalizer object, either in our code or in a dependent library, one should be overriding the finalize method. But in my whole project its nowhere used. (I am using Java8)

I am facing a memory issue, where for my service, as soon as I restart the service, the available memory starts reducing and within 7 days it is down by 95% with frequent warnings coming later on.

enter image description here Above graph shows the available memory in Y axis, which one can see reduces. All peaks in above graph is for restart of service.

When I went through the heap dump in eclipse Mat, I see the following :

enter image description here

As it can be seen, almost all the space is taken by 1 object only i.e. java.lang.ref.Finalizer but when I did a field Java search in my project, I don't see any code using the finalize() method.

And I have hit a dead end trying to find the memory leak. Is there any other reason which might be causing the issue.

enter image description here

enter image description here

enter image description here

1

There are 1 answers

0
Lucas Campos On

First thing IMO is to try to understand where the Finalizer is coming from - check your libs and try to spot that! Maybe they even mention something on their README/docs?

After that, have a look at this answer/question that can give you some insights. Also, it sounds to me something related to the GC. Since you mentioned java 8, you should be using the parallel GC (default one) which is not bad but you can try play with that, change GCs and see if any of the other options works better for you.