Wednesday, January 6, 2010

When out of memory

Enable the JVM's ability to dump the heap upon error and then analyze it with IBM HeapAnalyzer or Eclipse MAT.  To do so, add +-XX:+HeapDumpOnOutOfMemoryError to the JVM parameter line (or use jmap to force a heap dump if you know when it's close to dying).

+

You can also enable verbose GC logging to get a better sense of what the heap is doing:

-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -Xloggc:<gc-log-location.log>

No comments:

Post a Comment