tags:

views:

299

answers:

2

I am doing a pmap on a tomcat process and I am seeing some huge anon blocks. From what I read anon blocks are used for thread stacks and for JNI. I have a very moderate thread count. How can I go about finding out what is causing these huge anon blocks?

00000000ee0d0000 26752K rwx-- [ anon ]

00000000efaf0000 33792K rwx-- [ anon ]

00000000f1bf0000 25856K rwx-- [ anon ]

00000000f3530000 39680K rwx-- [ anon ]

( on a side note is pmap the correct way to measure how much memory is allocated to tomcat?)

A: 

Anonymous memory mappings are used for just about anything that needs some dynamically allocated memory, including e.g. thread stacks ,but also the heap.

nos
A: 

I have the same issue, By pmap, I found 697 [ anon ] blocks in my java application that used JNI. It exhausted the memory. When I comment the following line codes, the issue disappear.

jEnv->CallBooleanMethod(m_jobj, jmid, jData);

the method is pass a object from c++ to java side, it's called for many times (> 10000000)

But I cannot comment it, I need to call the method.

It's caused by JDK Bug6200343(memory leak in many jni calls (NewString etc.) ? my jdk version is java version "1.6.0_19" Java(TM) SE Runtime Environment (build 1.6.0_19-b04) Java HotSpot(TM) Server VM (build 16.2-b04, mixed mode)

Walter