Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Performance and the fly likes Tool for finding Memory Leaks in Java (experiencing OutOfMemoryErrors in 3rd party library) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Tool for finding Memory Leaks in Java (experiencing OutOfMemoryErrors in 3rd party library)" Watch "Tool for finding Memory Leaks in Java (experiencing OutOfMemoryErrors in 3rd party library)" New topic

Tool for finding Memory Leaks in Java (experiencing OutOfMemoryErrors in 3rd party library)

Manivo Edwards

Joined: May 02, 2012
Posts: 1
I have been searching for a tool to find the root cause of a memory leak. Stumbled upon - has anybody used it? Any experiences? Alternatives?
Winston Gutkowski

Joined: Mar 17, 2011
Posts: 7063

Manivo Edwards wrote:Alternatives?

Profiling, code reviews, and testing (cube the latter).


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Jayesh A Lalwani

Joined: Jan 17, 2008
Posts: 2052

Personally, I like JConsole, Mainly because it's installed with Java, so I know it;s going to be available in any environment

Plumr looks cool. Although, I don't know whether it will work in all cases. For example, if I have a pool of objects, and the normal operation is that the pool grows and reduces as the load on my server decreases and increases. An individual item in the pool is expected to stay in memory longer than it is required. Will plumr detect this as a memory leak? It is not a memory leak. Or what if I am putting too many objects in Session. Will plums detect it as a memory leak? One would say this may not be technically a leak, it is still a concern for high memory usage. How does it differentiate an object pool from a Session Pool
Paul Balm
Ranch Hand

Joined: Dec 13, 2008
Posts: 63
No, haven't used that, but I would recommend a plug-in for Eclipse called the Memory Analysis Tool. It has a functionality called the "memory leak suspects finder" which is smarter than me, I mean, very good.

By the way, this statement does not make sense: Getting OutOfMemoryErrors in a third-party library.

You run out of memory. At the point just before that, you are exactly at the limit -- all memory available to the JVM is in use and none can be freed up by garbage collection (slight simplification, please ignore). You can reach this limit in any place in your code, irrespective of where memory is being leaked. The OutOfMemoryError happens next time an object is created, for which some memory is needed. The place where you run out of memory does not tell you anything about the location of the problem. Really! Don't get thrown off by this. You need to understand which memory is not released, where you are expecting that it is. This is rarely an easy question to answer, unfortunately.


SCJP 1.4 -- SCJD Java 2 -- OCM JEA 5
Deepak Bala

Joined: Feb 24, 2006
Posts: 6657

I use jprofiler and can swear by it. Tool like jhat and analyzing VM specific dumps can also help you find the leak.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Kaushik Yeleswarapu

Joined: Aug 27, 2009
Posts: 5
One other thing to do would be to take thread dump on the server and try analyzing the thread dump using various analyzing tools like - TDA Thread dump analyzer and IBM Thread dump analyzer. That would give us an idea of what were the processes running when the out of memory error occured.
I agree. Here's the link:
subject: Tool for finding Memory Leaks in Java (experiencing OutOfMemoryErrors in 3rd party library)
Similar Threads
Free Memory Checker Tools For Java
Can any body suggest me, how to improve performance of the EJB Component?
How to measure Struts [session] memory
I need help which tool is best tool for gclogs?
Java Heap Space Error, OutofMemory Exception while writing large data to excel sheet.