The Analyze Java Virtual Machine (ANZJVM) command collects information about the Java Virtual Machine (JVM) for a specified job.
A set of JVM information is collected immediately when the command is run. This collected JVM data is called a snapshot.
A second snapshot is done a specified amount of time later.
By taking a snapshot of the JVM and comparing the data with a snapshot taken at a later time the data can be analyzed to help find object leaks.
To find object leaks, you would look at the number of instances of each class in the heap. Classes that have an unusually high number of instances should be noted as possibly leaking.
You should also note the change in number of instances of each class between the two copies of the garbage collection heap. If the number of instances of a class continually increases, that class should be noted as possibly leaking.
The longer the time interval between the two copies, the more certainty you have that objects are actually leaking.
By running ANZJVM a series of times with a larger time interval, you should be able to diagnose with a high degree of certainty what is leaking.
The information is dumped using printer device file QSYSPRT.
The user data for the QSYSPRT file is 'ANZJVM'.
The dump includes formatted information about the JVM heap.
Details include names of classes, number of active objects per class, and the class loader used to load each class.
When you run the ANZJVM command, there is a parameter to specify if a garbage collection cycle should be forced, and if so, an attempt is made to force a garbage collection cycle before each pass.
There are also parameters on how the information should be stored and how long the interval between passes should be.
The following ANZJVM command example collects two copies of the JVM 60 seconds apart for a job named QJVACMDSRC for user name QOTHPRDOWN and the job number 099112.
ANZJVM JOB (099112/ QOTHPRDOWN /QJVACMDSRV)