This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Performance and the fly likes Tomcat memory leak identification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Tomcat memory leak identification" Watch "Tomcat memory leak identification" New topic

Tomcat memory leak identification

sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
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.

[Thumbnail for profiling-netbeans2.png]

Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 443

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.

"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Arndt Br

Joined: May 28, 2012
Posts: 1
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 ( )

It's powerfull especially for just showing the problem without the need for an "eduacted searching procedure".
I agree. Here's the link:
subject: Tomcat memory leak identification
jQuery in Action, 3rd edition