About memory profiling in Java...
First, use the tool jvisualvm that ships with Java SE to connect to your local vm.
For remote VMs, see here
To analyse memory, you will need to generate hprof memory dump files.
I am using Java 1.5.0_14, therefore I do not have the tools available in Java 6 and 7 that allow you generate hprof files on-demand.
For local VMs, firststep is to add -XX:+HeapDumpOnOutOfMemoryError as a VM-arg. This means that when your program runs out of memory, a core dump will be generated.
Once you have a hprof file, install MAT (Memory Analysis Tool) in your Eclipse and open the hprof file using MAT perspective.
See their excellent introduction: http://wiki.eclipse.org/index.php/MemoryAnalyzer
For remote VMs, see here
To analyse memory, you will need to generate hprof memory dump files.
I am using Java 1.5.0_14, therefore I do not have the tools available in Java 6 and 7 that allow you generate hprof files on-demand.
For local VMs, firststep is to add -XX:+HeapDumpOnOutOfMemoryError as a VM-arg. This means that when your program runs out of memory, a core dump will be generated.
Once you have a hprof file, install MAT (Memory Analysis Tool) in your Eclipse and open the hprof file using MAT perspective.
See their excellent introduction: http://wiki.eclipse.org/index.php/MemoryAnalyzer
No comments:
Post a Comment