Studying garbage collection
The Java run-time system performs garbage collection automatically. It finds
memory that a program is no longer using and frees it.
Garbage collection can only be run if the process is active. It is
available from Package Statistics view, Class Statistics view and, when
instance level information is collected, Instance Statistics view.
To view details about garbage collection, follow these steps.
- In the Profiling Monitor view, select the monitor or agent.
Right click, then select Open With > Package Statistics.
The Package Statistics view opens.
- Ensure that the Live Instances and Collected columns are
visible. If they are not, right click, select Choose Columns, then set these
columns to be visible.
- See the results:
- In the Live Instances column, you can see how many
instances for the current packages are still alive, not garbage collected.
- In the Collected column, you can see how many
instances for the current packages are garbage collected.
- You can expand the current package to see the same
information at the class level or open the Class Statistics view.
- You can also drill down at the instance level using
Instance Statistics view, but only when you have collected instance level
information. (To collect instance level information, select the Show
Instance Level Information profiling option before launching or
attaching to the profiled application.)
- Click Run Garbage Collection
and then Refresh Views
. Notice the changes in the number of active instances and garbage collected, at
the package or class level.

- If you create a dump of the object references using the
Collect Object References
button
, the instances at which
you collected the object references will be indicated in the GC thread and
marked by the numbered generations.
Related concepts
Overview of the Profiling Tool
Execution flow view and table
Statistical views
Related tasks
Profiling an application
Launching or attaching a Java process
Identifying resource-intensive methods
Analyzing performance and memory usage - overview
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.