Find memory leaks

If the performance of your program degrades as it runs for a longer period of time, you may have erroneously coded a memory leak. You can use the Java™ Watcher to help you debug your program and locate memory leaks by performing Java application heap analysis and object create profiling over time.

For more details, see JavaWatcher.

You can also use the Analyze Java Virtual Machine (ANZJVM) control language command to find object leaks. ANZJVM finds object leaks by taking two copies of the garbage collection heap that are separated by a specified time interval. 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.