The most common reason to analyze memory usage is to find memory leaks. In Java, a memory leak refers to objects that loiter in the Java heap because they are not available for garbage collection. Another reason to analyze memory usage is to improve the efficiency with which the garbage collector runs.
This section describes some of the causes of loitering objects. It also describes how to locate and investigate loitering objects, and discover some techniques for solving problems. The procedures are general, but the screenshots and examples are taken from the LeakExample.class program installed in the <install_dir>\demos\memory\leakexample directory.