HP-UX Programmer's Guide for Java 2

Table Of Contents
We recommend you make a short and a long run. You can compare the two runs in
HPjmeter, and view the residual objects. Generally the lingering objects will percolate
to the top of the residual objects histogram, especially if the difference in run duration
is large enough or the leak rate is very high. Then you can look for objects of this type
in the Reference Graph. Following the graph from a candidate leaked object back
towards the root, you can see how that object is referenced by the application.
To determine if the application is leaking in the C heap, this can be easily observed
with GlancePlus in the Process Memory Regions window. The C heap is shown as the
DATA region. If the DATA region is continuously growing even after an extended
period of time at the steady load state, it may be a C heap memory leak.
There are several possible causes for a C heap leak with a java application:
Leak in user JNI native methods
Leak caused by a backlog of unexecuted java finalizers which hold on to C memory
Leak in JDK code itself
If you have native methods in your application, including Type 2 JDBC drivers from
third party vendors, you can use the HP gdb memory leak detection capability. This
functionality has been extensively used with the JDK itself and we find it very reliable.
Leaks caused by unexecuted finalizers can be tricky to detect. Many java classes that
use finalizers do so to free memory allocated in the C heap. Since execution of finalizers
is generally slower than creation of new objects, it is possible in some situations to fill
up the C heap with yet-to-be-finalized java-related memory allocations, which may
cause other parts of the application or JDK to fail. Finalizers are not executed
synchronously during garbage collections. You can measure the finalization with
-Xrunhprof:heap=dump then use the Reference Graph in HPjmeter to see what is
unfinalized.
If all else fails and you still see a leak, it is occasionally possible to discover a leak in
the JDK. You should contact your HP Response Center to report it.
Diagnosing memory leaks 73