IBM on troubleshooting Java applications
As of Java 6.0 Service Refresh 7 (SR7), the "Javadump": the javacore.txt file generated during a crash or when a user signal is sent to the process, now contains "native" (C) stack traces for each thread in addition to the Java stack trace that was already present.
You can find details on how to interpret the new information in the Java 6 Diagnostics Guide in the "Understanding diagnostic tools -> Using Javadump -> Interpreting a Javadump -> Threads and stack trace (THREADS)"
IBM Monitoring and Diagnostic Tools for Java - Garbage Collection and Memory Visualizer (GCMV) has been able to load, graph, and carry out leak detection for "native" memory on AIX and Linux for some time. With the newly released version 2.3, it will now also do so for Windows as well!
What is "native" memory and why monitor it?
Java applications run in a virtualized Java Runtime Environment (JRE), which provides the Java heap that is commonly associated with Java memory usage as it is where Java objects are created and managed for the application.
The main reason for monitoring "native" memory usage is the same as for Java heap memory: should the available memory become exhausted, an OutOfMemoryError will be generated. In addition, it's useful for understanding whether of not it's possible to increase the Java heap size should you want to. As the Java heap is one of the constituent parts of the native memory usage, increasing the Java heap size will increase the native heap usage and will lead to an OutOfMemoryError due to native heap exhaustion if it is increased to the point that the native memory usage exceeds the limit of what is available.
An excellent discussion on this topic, which includes what the OS memory limits are, is available from Andrew Hall's article "Thanks for the memory"on developerWorks.
Monitoring native memory usage in GCMV
GCMV can load and parse native memory usage data generated using svmon on AIX, ps on Linux and perfmon on Windows. Full instructions on how to generate the data are provided in the "Help" information provided by GCMV in ISA in the following section:
Once loaded in to GCMV, the memory usage data is available as raw, structured and tabbed data, graphed to produce a line plot, and a report provided that does statistical analysis and looks for potential memory leaks.
You may have realised that, as GCMV is graphing native memory, it's not specific to Java applications so can be used for any process. In fact, the output above is from the web browser running on my desktop.