Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat memory leak identification

 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have been using Netbeans profiler to profile my remotely running application .
All i get is a lot of native classes using up memory (Please see attachment).

How can i drill down from there to know the root cause of the memory leak.
My code is locally on my system but i am profiling a application running on a remote system.

Can anyone give me a nice hint of proceeding further.
profiling-netbeans2.png
[Thumbnail for profiling-netbeans2.png]
My screenshot
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First how do you know you have a leak out of memory, which GC are you using ?

The simplest trick is to run do a jmap at the start when you think its stable then when you think memory has risen jmap again and compare the difference.
Jmap and visualVM (very similar to NetBeans I believe same code base) are supplied free in the Java JDK.

As a quicky download Eclipse MAT (free) and run a leak report on one of your hprofs you think shows the leak to see if that tells you anything.

Your right in that looking at the base Java classes is usually pointless (except when I found a Java plugin bug lol) they are usually caused by something further down the list,... I would look down the list for the first of your classes or other lib you use even if seemingly small, from there with Eclipse Mat usually or Visual VM nearest GC root I work out what's the biggest consumer and then how/if they cause the bigger problems near the top. the other way you can tackle it is to use MAT to tell you what the biggest char [] consumer is etc but that's such a generic class that it can be hard to interpret the results. I usually have both Eclipse MAT and Visual VM on the job when fixing one of these.



 
Arndt Br
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris Hurst wrote:I usually have both Eclipse MAT and Visual VM on the job when fixing one of these.


You could also try bheapsampler ( http://www.dr-brenschede.de/bheapsampler/ )

It's powerfull especially for just showing the problem without the need for an "eduacted searching procedure".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic