简体   繁体   English

VisualVM内存泄漏?

[英]VisualVM memory Leaks?

I am trying to detect the memory leaks in my java application using VisualVM . 我正在尝试使用VisualVM检测我的Java应用程序中的内存泄漏。 I am using the VisualVM 1.3.5 . 我正在使用VisualVM 1.3.5

I followed the steps which should be said in this tutorial http://rejeev.blogspot.in/2009/04/analyzing-memory-leak-in-java.html 我遵循了本教程中应该说的步骤http://rejeev.blogspot.in/2009/04/analyzing-memory-leak-in-java.html

After following those steps, I don't know where I have to start edit my code. 完成这些步骤后,我不知道从哪里开始编辑代码。 Is there any way to find the java class and the line number where the memory was leaked to correct the code. 有什么方法可以找到泄漏内存的Java类和行号以更正代码。

Or any one suggest me a good way to find memory leaks using the VisualVM . 或者有人建议我使用VisualVM查找内存泄漏的好方法。

Good answers are definitely appreciated . 好的答案肯定会受到赞赏。

No profiling tool will give you the line where a potential memory leak is concurring. 没有任何分析工具可以帮助您发现潜在的内存泄漏问题。

Profiling an application takes a bit more effort than that. 对应用程序进行性能分析比这要花费更多的精力。 Usually, a tool like VisualVM will, for instance, show you what type of Objects are being instantiated the most, and that can indicate where the problem is. 通常,例如,VisualVM之类的工具将向您显示最实例化什么类型的对象,并且可以指示问题出在哪里。

For instance, if a huge amount of byte[] objects are being created, perhaps you're not closing the Input/Output streams you are creating? 例如,如果要创建大量的byte []对象,也许您不是要关闭正在创建的Input / Output流?

There is no silver bullet to find memory leaks, it takes effort and some practice, and is completely application dependent. 没有发现内存泄漏的灵丹妙药,它需要付出努力和一些实践,并且完全取决于应用程序。

That being said, this link might help as well: 话虽如此,该链接也可能有帮助:

http://www.kdgregory.com/index.php?page=java.outOfMemory http://www.kdgregory.com/index.php?page=java.outOfMemory

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

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