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. In the Profiling Tool, garbage collection can only be run if the process is active.  Garbage collection is available from Memory Statistics view. Prerequisites:
Before being able to analyze profiling data to study garbage collection, ensure that the following step has been completed:

To view details about garbage collection, follow these steps:

  1. In the Profiling Monitor view, select the monitor or agent.

  2. Right click, then select Open With > Memory Statistics. The Memory Statistics view opens.

  3. Click Package from the toolbar to display the package statistics.

  4. Check 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.

  5. Note the results:

    • In the Live Instances column, you can see how many instances for the current packages are still alive, and 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 click Class to view the statistics at the class level.

    • You can view the actual instances for a particular class, select the class and click the Instance in the toolbar. The instance level is available only if you have collected instance level information in the profiling criteria. To setup the profiling criteria, refer to the Specifying profiling criteria topic.

  6. In the Profiling Monitor view, select the monitor or agent.

  7. Right click and select Run Garbage Collection 

  8. In the Memory Statistics view, right-click and select Refresh Views . The view is refreshed showing the changes in the number of active instances at the package level.

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