Is there a way to make a live heap heap using ibm-jdk for linux?

I know that it is possible to unload a bunch when an OutOfMemoryException occurs in this JVM, but is it possible to ask a live dump using tools like jmap or jconsole?

+6
java jmap jconsole
source share
4 answers

OK, I will finally answer myself: the application has a remote admin interface, so I will implement a new command that calls the com.ibm.jvm.Dump.HeapDump() method.

+3
source share

You need to know that there are "system" dumps (mainly OS kernel files) and a heap, as well as portable heaps (PHDs). Later ones are less useful as they do not contain actual data. By default, they are enabled.

On AIX or Linux, you usually configure -Xdump:system (short for -Xdump:system:events=gpf+user ) to allow kill -3 <pid> to start a bunch of heaps.

By the way, you can use the default options kill -ABRT <pid> . However, this will interrupt your JVM.

Run java -Xdump:what to see your default values, for example:

 > /usr/java6/bin/java -Xdump:what -version Registered dump agents ---------------------- -Xdump:system: events=gpf+abort+traceassert, label=/home/u0002824/core.%Y%m%d.%H%M%S.%pid.%seq.dmp, range=1..0, priority=999, request=serial ---------------------- ... java version "1.6.0" Java(TM) SE Runtime Environment (build pap3260sr9fp2-20110627_03(SR9 FP2)) 

When enabling system dumps:

 > /usr/java6/bin/java -Xdump:system -Xdump:what -version Registered dump agents ---------------------- -Xdump:system: events=gpf+user+abort+traceassert, label=/home/u0002824/core.%Y%m%d.%H%M%S.%pid.%seq.dmp, range=1..0, priority=999, request=serial ---------------------- -Xdump:heap: events=systhrow, filter=java/lang/OutOfMemoryError, label=/home/u0002824/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd, range=1..4, priority=500, request=exclusive+compact+prepwalk, opts=PHD ---------------------- -Xdump:java: events=gpf+user+abort+traceassert, label=/home/u0002824/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt, range=1..0, priority=400, request=exclusive+preempt ---------------------- -Xdump:java: events=systhrow, filter=java/lang/OutOfMemoryError, label=/home/u0002824/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt, range=1..4, priority=400, request=exclusive+preempt ---------------------- -Xdump:snap: events=gpf+abort+traceassert, label=/home/u0002824/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc, range=1..0, priority=300, request=serial ---------------------- -Xdump:snap: events=systhrow, filter=java/lang/OutOfMemoryError, label=/home/u0002824/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc, range=1..4, priority=300, request=serial ---------------------- ... 

Remember to run jre/bin/jextract in the file . * .dmp .

+6
source share
+4
source share

I think there is one tool like JProfiler. it will work well with eclipse

0
source share

All Articles