Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Manivo Edwards
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been searching for a tool to find the root cause of a memory leak. Stumbled upon http://plumbr.eu/ - has anybody used it? Any experiences? Alternatives?
 
Winston Gutkowski
Bartender
Pie
Posts: 10253
59
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manivo Edwards wrote:Alternatives?

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

Winston
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Cheers-
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use jprofiler and can swear by it. Tool like jhat and analyzing VM specific dumps can also help you find the leak.
 
Kaushik Yeleswarapu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic