Talkin’ ’bout my Generation, or How I Learned More Than I Ever Wanted About JVM Memory
declare pid=$(pidof java);
watch -n 2 "sudo /usr/java/jdk1.6.0_26/bin/jmap -heap $pid 2>&1 | grep -A 4 'Perm' "
- The JVM can dump your heap to a file when it crashes. To do this enable
+XX:HeapDumpOnOutOfMemoryErrorand set a path for the dump file,
- I used the Eclipse MAT tool to analyze my dump file and had a great experience. It’s worth reading the manual on its basic functions before using it. The default reports available gave me an immense amount of actionable information. If the OOM errors recur, I will likely be turning to MAT to dig to the bottom of the (potential) leak.
- This article was substantially valuable in wrapping my head around how the JVM interacts with native memory, http://www.ibm.com/developerworks/java/library/j-nativememory-linux/