Thursday, January 21, 2010
How to analyse Out of Memory Error, fix java memory leak
Add the following JVM arguments for your java process to analyse and fix memory leaks.
XX:+HeapDumpOnOutOfMemoryError -verbose:gc
Download MAT (memory analyser tool) http://www.eclipse.org/mat/
Open the head dump file with tool.
Ex: root@serkanslnx:/space/tools/mat# ./MemoryAnalyzer /tmp/java_pid2774.hprof
Note: If you are using java 1.6 you can use the built in tools to get heapDump at runtime also like below example
[root@sunelslnx lib]#/usr/java/jdk1.6.0_17/bin/jmap -dump:file=/space/myHeapDump.dmp 27400
27400 is the process id here :)
A useful page
Another historical page
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment