简体   繁体   中英

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

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.

在此处输入图像描述 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:

在此处输入图像描述

As it can be seen, almost all the space is taken by 1 object only ie 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.

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM