Tuesday, July 19, 2011

Sun JVM heap dump on OutOfMemory

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html


-XX:+HeapDumpOnOutOfMemoryError does the job!!!!


better to add also -XX:HeapDumpPath=/your/path/to/heapdump/dir

(it should be a dir, not a file)


Ad the end of setDomainEnv.sh, put:


if [[ "${SERVER_NAME}" == *as ]]
then
MEM_ARGS="-Xms1g -Xmx1g -XX:MaxPermSize=512m"
else
MEM_ARGS="-Xms2g -Xmx2g -XX:MaxPermSize=768m"
fi

MEM_ARGS="${MEM_ARGS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${DOMAIN_HOME} -Xloggc:/opt/var/log/weblogic/server/${SERVER_NAME}gc.log"
export JAVA_OPTIONS MEM_ARGS



(this loggc option has the disadvantage that gc of multiple servers ends up in the same file... it can be improved... )

No comments: