Skip to content

memory analysis

April 14, 2009

-XX:+HeapDumpOnOutOfMemoryError

With this option enabled, when running out of space JVM will not only throw a java.lang.OutOfMemoryError exception but also generate a hprof file. You will see something like:

java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid3464.hprof …
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
Heap dump file created [67197032 bytes in 2.454 secs]

run jps

get the process id

run jmap

jmap  -dump:format=b,file=test.hprof 5160

get the hprof.

open in sap memory analyzer eclipse plugin.

Get gcore pid . On solaris machine : Use the cmds : pstack , pflags (thread) or dbx, gdb , mdb

truss -f -p <pid> -o logfile.txt
Shows the system call the app is performing

kill -3 or kill -QUIT only works on jdk 1.4.2._18  and not prior to it and we are using the jdk version j2sdk1.4.2_05

utilities:

lsof
strace
/var/adm/messages – system error messages
lsof – number of open files
: ulimit value
: root – kernel parameters nofile depend

/var/adm/messages

lsof – number of open files
: ulimit value: root – kernel parameters nofile depend

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: