English 中文(简体)
• 查明肥皂堆放场中的旧基因(或只接收旧基因的肥料)
原标题:Identify old gen in heap dump (or take heap dump of old gen only)

I think I have a memory leak.
(they say the first step is admitting the problem, right?)

Anyway, I think I do - see attached image for heap by regions: heap regions. Green is Eden, blue/red is S0/S1, purple is old. I have unlimited tenuring (>15), lots of time passed between memory being allocated and it spilling to old gen. Hence - a memory leak. I think.

因此,问题——我如何分析泄漏情况? 你可以看到,我的爱登非常积极。 整整刻制造和销毁的物体。

是否有办法将旧的基因堆放掉? 或者说,在完全的肥皂堆放场(如果是的话,用什么工具)中发现了旧的基因?

Edit 1: Clarification: I m not doing anything that should retain objects in memory. Everything I allocate after the initial startup should die young.

Edit2: New findings: I took a heap dump, GCed like crazy and took another. The second one shows a significantly reduced level of old gen usage. The main difference between the two were objects held by finalizers. Don t finalizers run in young GC cycles? Do they always wait for a full GC to be cleaned?

问题回答

看到一些东西传播到旧的基因中,这是一个令人严重关切的问题。 在您的旧基因达到一定门槛之后,整个GC将停止。 如果这 t无法恢复记忆,你就有一个问题。 你在一次年轻的收集中看到一些记忆,这一事实令人不安。

lots of time passed between memory being allocated and it spilling to old gen. Hence - a memory leak. I think

其实,仅仅因为记忆被添加到旧的基因中,就意味着记忆被泄露。 在年轻的采集过程中,通常的做法是将旧的物体提升到老年。 正是在这些年轻的采集过程中,老的物体被添加到旧的基因中。 这或许只是你的申请仍在影响之中。 在大规模应用中,可能有一些特征没有每天使用,而后你会记得这些特征。

尽管如此,如果你真心关心把任何记忆添加到旧的基因中,并希望进一步调查,我建议把这一申请放在一个不平静的环境中。 每位简介员(VisualVER将工作)和负荷测试(JMeter是好的和免费的)您的申请。 如果看一看物体,你就能够了解哪一代物体。 你们还想看到,如果你老的先辈达到一个完全的GC将消失的门槛值(通常在70%-90%之间)。 如果您的原有基因恢复到20%的门槛值,那么就没有泄漏。 在某些情况下,旧的先质可能永远不会达到完全的GC被打走的地步,而是会达到预期的水平。 负荷测试将有助于确定这一点。

If it doesn t recover and you confirm you have a memory leak then you will want to capture a heap dump (hprof) and use a tool like MAT (Memory Analyzer Tool) to analyze the dump to find the culprit.

Using JVisualVM (part of the JDK since Java 6 Build 10 or something like that), you can look at the TYPE of objects that are in memory. That will help you track down where the leak is. Of course, it takes a lot of digging into the code, but that s the best tool I ve used that always available and reliable.

看到周围的物体,可以是,你可以操作,保存在一份清单或阵列中,但没有清除。 我认为,如果我看一看正在制造的物体数目,并在几分钟内存放在JVisualVER,那么我通常会想到,在法典中,没有释放的犯罪物体会到哪里去。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签