Patent ID: 7599973

Claim:
A computer implemented method for performing garbage collection in a memory heap of a computer system, comprising: dividing the memory heap into a young generation and an old generation, wherein the young generation comprises a plurality of regions; counting a first number of bytes (NOB) evacuated from a first region during a first garbage collection cycle (GCC); counting a second NOB evacuated from a second region during the first GCC, wherein the plurality of regions includes the first region and the second region; calculating a first survival rate for the first region based on the first NOB, and a second survival rate for the second region based on the second NOB; dividing the plurality of regions, based on a predetermined survival rate boundary, into a prefix group and a suffix group, wherein the prefix group comprises the first region, wherein the suffix group comprises the second region, wherein the first survival rate and the second survival rate are on opposite sides of the predetermined survival rate boundary, and wherein the first survival rate exceeds the second survival rate; identifying a plurality of objects in the prefix group comprising pointers to a first plurality of objects in the suffix group; evacuating the first plurality of objects in the suffix group from the suffix group to an allocated space outside the suffix group in the memory heap; reclaiming memory in the suffix group for reuse by the computer system during a second GCC after evacuating the first plurality of objects in the suffix group, wherein memory in the prefix group is not reclaimed during the second GCC; calculating a plurality of garbage collection efficiencies for a plurality of prefix group sizes after reclaiming memory in the suffix group, wherein at least one of the plurality of garbage collection efficiencies is calculated by dividing a dividend comprising a size of an object of the first plurality of objects, by a divisor comprising a time for evacuating the object; and selecting a prefix group size from the plurality of prefix group sizes for a third GCC, wherein the prefix group size corresponds to a maximum garbage collection efficiency of the plurality of garbage collection efficiencies.