Garbage collection and other management of memory heaps
AssigneeInternational Business Machines Corporation
InventorThomas J. Heller, Jr.
Life of this patent
Estimating the term…
Abstract
A memory heap management facility is provided that is able to perform various management tasks, including, but not limited to, garbage collection, compaction, and/or re-ordering of objects within a heap. One or more of these management tasks improve system performance by limiting movement of pages in and out of virtual memory. The garbage collection technique selectively performs garbage collection such that certain objects, such as old but live, infrequently referenced objects, are not garbage collected each time garbage collection is performed.
Claims18
A computer system for facilitating management of memory heaps, said computer system comprising:
- a memory;
- and
- a processor in communications with the memory, wherein the computer system is configured to perform a method, said method comprising:
- selecting a heap section of a memory heap to be examined for garbage collection, the heap section comprising a plurality of groups, the plurality of groups defined such that groups include objects of particular types, a particular type being defined based on frequency of reference of the objects within a group;
- selecting one or more groups of the plurality of groups of the heap section to be examined for garbage collection, the selecting being based on the particular type of the one or more groups;
- determining whether garbage collection is to be performed for the selected one or more groups;
- and
- performing garbage collection on the selected one or more groups based on the determining indicating garbage collection is to be performed for the selected one or more groups, wherein the performing garbage collection comprises:
- selecting an object of a group of the one or more groups selected for garbage collection;
- determining whether the object is marked as reachable;
- returning memory of the object to a free list of memory, based on the determining indicating the object is not reachable;
- checking whether a reference indicator of the object is set, based on the determining indicating the object is marked as reachable;
- and
- moving the object from the group to another group of a particular type that differs from the particular type of the group, based on the checking indicating the reference indicator is not set.
A computer program product for facilitating management of memory heaps, said computer program product comprising:
- a computer readable storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method comprising:
- selecting a heap section of a memory heap to be examined for garbage collection, the heap section comprising a plurality of groups, the plurality of groups defined such that groups include objects of particular types, a particular type being defined based on frequency of reference of the objects within a group;
- selecting one or more groups of the plurality of groups of the heap section to be examined for garbage collection, the selecting based on the particular type of the one or more groups;
- determining whether garbage collection is to be performed for the selected one or more groups;
- and
- performing garbage collection on the selected one or more groups based on the determining indicating garbage collection is to be performed for the selected one or more groups, wherein the performing garbage collection comprises:
- selecting an object of a group of the one or more groups selected for garbage collection;
- determining whether the object is marked as reachable;
- returning memory of the object to a free list of memory, based on the determining indicating the object is not reachable;
- checking whether a reference indicator of the object is set, based on the determining indicating the object is marked as reachable;
- and
- moving the object from the group to another group of a particular type that differs from the particular type of the group, based on the checking indicating the reference indicator is not set.
Dependencies are inferred from the claim text.