Question

I am trying to detect the memory leaks in my java application using VisualVM. I am using the 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

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.

Or any one suggest me a good way to find memory leaks using the VisualVM.

Good answers are definitely appreciated .

Was it helpful?

Solution

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.

For instance, if a huge amount of byte[] objects are being created, perhaps you're not closing the Input/Output streams you are creating?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top