Tuesday, August 22, 2006

jmap and heap dumps on 1.4.2

At work we have what might be a memory leak on our production server (it is running the Sun JDK 1.4.2 Update 12 on a Linux server), now it seemed that we might be able to use jmap which has been backported to 1.4.2 to get a heap dump. When I tried this on my desktop I kept getting the error: buckett@oucs-matthewb:~ $ jmap Exception in thread "main" java.lang.NoClassDefFoundError: sun/jvm/hotspot/tools/JMap Now initially I though that I had a problem with JAVA_HOMEs and PATHs. But it turns out that Sun only backported jmap for Solaris (Windows is no luckier), but continue to ship everyone the binary just tempt them. The other option is -Xrunhprof but as we didn't start the JVM orginally with this option there doesn't seem to be a way to get a heap dump without restarting the service. gcore could give us a 1.5Gb core file for the process but there doesn't seem to be a nice way to process this under 1.4. Maybe it is time to switch to 1.5?

2 comments:

Unknown said...

Hi,
You can use the option
-XX:+HeapDumpOnCtrlBreak

check my blog here :

The amazing new heap dump feature in JDK 1.4.2_12

Regards,
Markus

Phoenix2Life said...

Is there any way to get Heap Dump on 1.4.2_7 on Red Hat Linux 4.x ? I have tried JMAP and have received NoClassDefFoundException. Also -XX option do not work.

Any help would be sincerely appreciated.