Next: Unnecessary Object Retention
Up: Heap Profiling
Previous: Excessive Heap Allocation
Algorithm-Independent Allocation and Garbage Collection Events
Many memory allocation and garbage collection algorithms are suitable
for different Java virtual machine implementations. Mark-and-sweep,
copying, generational, and reference counting are some examples. This
presents a challenge to designing a comprehensive profiling interface:
Is there a set of events that can uniformly handle a wide variety of
garbage collection algorithms?
We have designed a set of profiling events that covers all garbage
collection algorithms we are currently concerned with. We introduce the
abstract notion of an arena, in which objects are allocated. The
virtual machine issues the following set of events:
-
NEW_ARENA(arena ID)
-
DELETE_ARENA(arena ID)
-
NEW_OBJECT(arena ID, object ID, class ID)
-
DELETE_OBJECT(object ID)
-
MOVE_OBJECT(old arena ID, old object ID, new arena ID, new object ID)
Our notation encodes the event-specific information in a pair of
parentheses, immediately following the event type. Let us go through
some examples to see how these events may be used with different
garbage collection algorithms:
-
A mark-and-sweep collector issues NEW_OBJECT events when
allocating objects, and issues DELETE_OBJECT events when adding
objects to the free list. Only one arena ID is needed.
-
A mark-sweep-compact collector additionally issues MOVE_OBJECT events.
Again, only one arena is needed, the old and new arena IDs in the
MOVE_OBJECT events are the same.
-
A standard two-space copying collector creates two arenas. It issues
MOVE_OBJECT events during garbage collection, and a DELETE_ARENA event
followed by a NEW_ARENA event with the same arena ID to free up all
remaining objects in the semi-space.
-
A generational collector issues a NEW_ARENA event for each generation.
When an object is scavenged from one generation to anther, a
MOVE_OBJECT event is issued. All objects in an arena are implicitly
freed when DELETE_ARENA event arrives.
-
A reference-counting collector issues NEW_OBJECT events when new
objects are created, and issues DELETE_OBJECT events when the reference
count of an object reaches zero.
In summary, the simple set of heap allocation events support a wide
variety of garbage collection algorithms.
Next: Unnecessary Object Retention
Up: Heap Profiling
Previous: Excessive Heap Allocation
Sheng Liang
1998-12-19