9.8.1 Overview of the unused objects statistical functionality in the Tenured area
You can use the unused objects statistical functionality in the Tenured area to identify only the unused objects that are accumulated in the Tenured area, and output them to the thread dump file. This subsection describes the mechanism of the unused objects statistical functionality in the Tenured area.
- Organization of this subsection
(1) Output of the size of unused objects
Objects with a long life accumulate in the Tenured area based on iteration of the copy GC. Among the accumulated objects with a long life, the objects that lose their usage as time lapses, remain in the Tenured area as unused objects. After this, a Full GC occurs when the memory becomes full. You can check the usage of the Tenured area from the time of occurrence of a copy GC until the time of occurrence of a Full GC by using the unused objects statistical functionality in the Tenured area and the instance statistical functionality.
The following figure shows the contents that you can identify using the unused objects statistical functionality in the Tenured area and the instance statistical functionality.
|
When the instance statistical functionality is executed without executing the pre-statistical GC, the size of the unused object shown in step 3 in Figure 9-10 is output. This size is same as the memory usage status in the Tenured area that includes the size of unused objects of the Tenured area corresponding to step 1 of Figure 9-10 and the objects in use in the Tenured area corresponding to step 2 of Figure 9-10.
On the other hand, when you execute the unused objects statistical functionality in the Tenured area, you can output the memory usage status (corresponding to step 1 of Figure 9-10) in the Tenured area that excludes the objects in use shown in step 2 of Figure 9-10. You can use the unused objects statistical functionality in the Tenured area to identify the unused objects that act as the augmentation factors for the Tenured area, which enables you to inhibit the Full GC.
(2) Checking the reference relationship of unused objects
In the unused objects statistical functionality of the Tenured area, search the base objects in the ascending order of their address in the Tenured area. Even among the searched objects, the objects that are not investigated in another reference relationship become the base objects.
When you have already investigated the referenced objects, return to the branching point and investigate the reference relationship. Also, if a referenced object is the base object of another reference relationship, then handle as a referenced object. Investigate a reference relationship until all base objects are eliminated.
For the unused objects statistical functionality in the Tenured area, the total of the number of instances and instance size is output. Add the corresponding classes for number of instances. The following contents are output to the total size of instances:
-
The size of the base objects is added to the corresponding class. The size of the referenced objects is added to the corresponding class, and then added to the corresponding classes of the base objects and all objects that exist in the reference relationship up to the corresponding class.
Note that when you execute the unused objects statistical functionality in the Tenured area, the instance statistical functionality, STATIC member statistical functionality, and pre-statistical GC selection functionality become disabled.
The following figure shows an example of the reference relationship based on the unused objects in the Tenured area.
|
The reference relationship shown in Figure 9-11 is described as follows:
- Number of instances
-
-
classA: One, because of the existence of a1
-
classB: Two, because of the existence of b1 and b2
-
classC: Two, because of the existence of c1 and c2
-
- Total instance size
-
-
classA: 122, when the size of the instance of classA (a1) and the size of the referenced instances (b1, b2, c1, c2) are added
-
classB: 22, when the size of the instances of classB (b1, b2) and the size of the referenced instances (c1, c2) are added
-
classC: 2, when the instances of classC (c1, c2) are added
-
The following is an output example, when the reference-related information shown in Figure 9-11 is output by executing the unused objects statistical functionality in the Tenured area:
Garbage Profile --------------- ________________Size__Instances__Class________________ 122 1 A 22 2 B 2 2 C