How to track Java 1.4 memory leak and performances :SUN profiler

Use of SUN profiler with HPjmeter dump analyser

Execute the procedure below StepAction

1.Install the HPjmeter.jar file on your PC in any directory: let?s call it <hpjmeter directory>. The jar file can be found in h:\users\in\edel\hpjmeter.

2.Start the JVM to debug with options:

-Xrunhprof:heap=all,thread=y,cutoff=0 -Xnoclassgc -Xusealtsigs

(for memory leak debugging)

or

-Xrunhprof:cpu=samples,thread=y,depth=10,cutoff=0 ?Xnoclassgc -Xusealtsigs

(for cpu load optimization)

Note that these options seems not compatible with option "-XX:+UseParallelGC"

Note also that some HPROF error messages may appear at startup.

3.Get the process id of the JVM to debug: <JVM pid>

4.Start the traffic on the JVM to debug during a few seconds or minutes and make sure to count the number of calls sent to the JVM during this period if you plan to debug memory leaks.

5.Kill the JVM process with "kill <JVM pid>

6.Check if a file named "java.hprof.txt" has been generated in the directory where you have started the JVM.

7.Transfer that file on your PC in BINARY mode in the <hpjmeter directory>

8.Start the hpjmeter analyser on your PC under a DOS session from the <hpjmeter directory> by typing: "java ?jar hpjmeter.jar"

9.Enjoy the results. Note that the "memory leak guess" function is definitely not reliable. It is better to have a look at the "live objects count" metric and look for application objects count corresponding to the number of calls done à could correspond to the objects which have not been properly de-referenced and therefore not garbage collected.

No comments:

Post a Comment