问题描述
我负责调试Java(J2SE)应用程序,该应用程序在一段时间的活动后开始抛出OutOfMemory异常。我是Java新手,但有编程经验。我有兴趣了解如何诊断这种问题的好方法吗?
I've been tasked with debugging a Java (J2SE) application which after some period of activity begins to throw OutOfMemory exceptions. I am new to Java, but have programming experience. I'm interested in getting your opinions on what a good approach to diagnosing a problem like this might be?
到目前为止,我已经使用JConsole来了解什么是继续。我有一个预感,有没有被正确释放的对象,因此没有被清理垃圾收集期间。
This far I've employed JConsole to get a picture of what's going on. I have a hunch that there are object which are not being released properly and therefor not being cleaned up during garbage collection.
有没有我可能用来获取图片的工具物体生态系统?你会从哪里开始?
Are there any tools I might use to get a picture of the object ecosystem? Where would you start?
推荐答案
我会从一个适当的Java分析器开始。 JConsole是免费的,但它远不及那些花钱的功能。我使用JProfiler,这是非常值得的钱。请参阅以获得更多选择和意见。
I'd start with a proper Java profiler. JConsole is free, but it's nowhere near as full featured as the ones that cost money. I used JProfiler, and it was well worth the money. See https://stackoverflow.com/questions/14762/please-recommend-a-java-profiler for more options and opinions.
这篇关于Java内存问题的诊断策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!