English 中文(简体)
OutOfMemory异常-VisualVM如何通过堆转储文件帮助定位内存泄漏?
原标题:OutOfMemory Exception - how does VisualVM help locate the memory leak with heapdump file?

我一直在我的电脑上本地测试我的网络应用程序,并用VisualVM监控它。我最近也开始使用JMeter,因为有人建议我应该做一些负载测试,因为我怀疑我在某个地方有缓慢的内存泄漏。

今天,我的网络应用程序终于抛出了OutOfMemory异常。我设置了HeapDumpOnOutOfMemoryErrorHeapDumpPath参数,以防发生这种情况。生成了堆转储文件。

我在VisualVM中打开了这个文件(java_pid2760.hprof),老实说,我不明白我应该如何找出这次内存泄漏的罪魁祸首。。。

如何使用VisualVM来分析堆转储并找到产生内存泄漏的类/实例?

最佳回答
问题回答

使用VisualVM来分析堆转储和定点内存泄漏并不容易,如果这是您第一次处理此类问题,我不建议您使用此工具。考虑下载HPjmeter并让它为您完成工作。

打开转储文件后,选择“排序的引用图子树”选项。这将显示Web应用程序中按大小排序的所有对象。在大多数内存泄漏场景中,您正在泄漏一种类型的Object,它会随着时间的推移在堆中膨胀。HPjmeter将帮助您快速识别此案例。





相关问题
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 ...

热门标签