简体   繁体   English

Java Memory 问题:Java.lang.ref.finalizer object

[英]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.在大多数关于由终结器 object 引起的 memory 泄漏的研究中,无论是在我们的代码中还是在依赖库中,都应该重写 finalize 方法。 But in my whole project its nowhere used.但在我的整个项目中,它无处使用。 (I am using Java8) (我使用的是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.我面临一个 memory 问题,对于我的服务,一旦我重新启动服务,可用的 memory 开始减少,并在 7 天内下降了 95%,随后会频繁出现警告。

在此处输入图像描述 Above graph shows the available memory in Y axis, which one can see reduces.上图在 Y 轴上显示了可用的 memory,可以看到减少了。 All peaks in above graph is for restart of service.上图中的所有峰值均用于重新启动服务。

When I went through the heap dump in eclipse Mat, I see the following:当我浏览 eclipse Mat 中的堆转储时,我看到以下内容:

在此处输入图像描述

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.可以看出,几乎所有空间都被 1 object 占用,即java.lang.ref.Finalizer但是当我在我的项目中搜索字段 Java 时,我没有看到任何使用 finalize() 方法的代码。

And I have hit a dead end trying to find the memory leak.我在寻找 memory 泄漏时遇到了死胡同。 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? IMO 的第一件事是尝试了解Finalizer的来源 - 检查您的库并尝试发现它? 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.此外,在我看来,这与 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.由于您提到了 java 8,您应该使用并行 GC(默认),这还不错,但您可以尝试使用它,更改 GC 并查看是否有任何其他选项更适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 内存提升后java.lang.ref.Finalizer OutOfMemory - java.lang.ref.Finalizer OutOfMemory After Memory Raise Wildfly 10.1.0.FINAL(java.lang.ref.Finalizer / ActiveMQConnection)上的内存泄漏 - Memory leak on Wildfly 10.1.0.FINAL (java.lang.ref.Finalizer / ActiveMQConnection) Java 在 java.lang.ref.Finalizer 上设置的断点未停止 - Java Breakpoint set on java.lang.ref.Finalizer not stopped 使用 Spring webServiceTemplate 和 jaxb 库会导致 «java.lang.ref.Finalizer» 的内存泄漏 - Using Spring webServiceTemplate and jaxb library leads to memory leak with «java.lang.ref.Finalizer» 是内存泄漏吗? 为什么 java.lang.ref.Finalizer 吃掉这么多内存 - is memory leak? why java.lang.ref.Finalizer eat so much memory Finalizer线程正在等待时java.util.ref.Finalizer的内存泄漏 - Memory leak of java.util.ref.Finalizer while Finalizer thread is waiting Java内存泄漏终结器工具包 - Java Memory Leaks Finalizer Your Kit Memory 语义 java.lang.ref.Reference 方法 - Memory semantics of java.lang.ref.Reference methods 由java.lang.ref.FinalizerReference引起的内存泄漏 - Memory leak caused by java.lang.ref.FinalizerReference 使用 java.lang.ref.Cleaner 替代 Object.finalize - Usage of java.lang.ref.Cleaner as alternative to Object.finalize
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM