Wednesday 5 February 2014

JVM - Memory Analysis


Decompiler
Yet another fast Java decompiler http://jd.benow.ca/

Memory Dump
To create a heap dump, use the jmap command from JDK:

  • jps - to find the process id
  • jmap -dump:format=b,file=heap.jmap java_PID 
  • -XX:+HeapDumpOnOutOfMemoryError VM parameter  
    • java -Xmx256m -XX:+HeapDumpOnOutOfMemoryError -jar *.jar
  •  jconsole /usr/jdk/jdk1.6.0_105/bin/jstack 24583 > outfile.txt 


Memory dump Analysis Tools 

  • jhat : http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html 
  • VISUALVM : http://visualvm.java.net/gettingstarted.html 
  • Eclipse Memory Analyzer (MAT)
  • JProfiler 












References : 

  • http://java.sun.com/developer/technicalArticles/J2SE/monitoring/
  • http://www.oracle.com/technetwork/java/javase/index-138283.html#guides
  • http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html 
  • http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html 
  • http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jmap.html 
  • http://marxsoftware.blogspot.com.au/2009/06/heap-dump-and-analysis-with-visualvm.html 
  • http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html 
  • https://redstack.wordpress.com/2011/01/06/visualising-garbage-collection-in-the-jvm/
  • https://plumbr.io/outofmemoryerror/permgen-space