Method and apparatus for dynamically pre-tenuring objects in a generational garbage collection system
AssigneeSun Microsystems, Inc.
InventorsDavid L. Detlefs, Antonios Printezis, Fabio Rojas
Life of this patent
Estimating the term…
Abstract
In a generational garbage collector, a decision is made to pre-tenure, or allocate new objects directly in the old generation, by a two step process. In the first step, during a young-generation collection, the number of bytes that survive collection is determined for each allocation site and a predetermined number of sites with the highest number of surviving bytes are selected as candidate sites. In the second step, during a subsequent young-generation collection, the survival rates are determined for the candidate sites and objects to be allocated from sites with a sufficiently high survival rate are allocated directly in older generations.
Claims39
A method for dynamically pre-tenuring new object memory allocation in a generational garbage collector, comprising:
- initiating a memory collection of a first young generation;
- determining the number of bytes allocated at a plurality of allocation sites that survive collection;
- selecting a plurality of candidate sites with the highest number of bytes that survive collection from the plurality of allocation sites;
- completing the memory collection of the first young generation;
- initiating a memory collection of a second young generation after the completion of the memory collection of the first young generation;
- determining, for each of the plurality of candidate sites, a survival rate of allocated bytes that survive memory collection;
- and
- storing to an older generation in a memory heap a plurality of objects from the plurality of candidate sites with survival rates greater than a predetermined threshold.
An apparatus for dynamically pre-tenuring new object memory allocation in a generational garbage collector, comprising:
- a memory;
- a surviving byte counting mechanism resident in memory and operable during a first young generation collection for a plurality of allocation sites, that determines the number of bytes allocated at each of the plurality of allocation sites that survive collection;
- a candidate selection mechanism resident in memory that selects a plurality of candidate sites from a plurality of allocation sites with the highest number of bytes that survive collection as determined by the surviving byte counting mechanism;
- a survival rate mechanism, resident in memory and operable during a second young generation collection occurring after the first young generation collection, that determines, for each of the plurality of candidate sites, a survival rate of bytes allocated that survive collection;
- and
- an allocation mechanism resident in memory that stores to an older generation in a memory heap a plurality of objects from the plurality of candidate sites with survival rates as determined by the survival rate mechanism greater than a predetermined threshold.
An apparatus for dynamically pre-tenuring new object memory allocation in a generational garbage collector, comprising:
- a memory heap;
- surviving bytes counting means, operable during a first young generation collection and for each of a plurality of allocation sites, for determining the number of bytes allocated at each of the plurality of allocation sites that survive collection;
- candidate selecting means for selecting as candidate sites a plurality of allocation sites with the highest number of bytes that survive collection;
- survival rate means, operable during a second young generation collection occurring after the first young generation collection, for determining, for each of a plurality of candidate sites, a survival rate of bytes allocated at each of a plurality of candidate sites that survive collection;
- and
- means for storing to an older generation in the memory heap a plurality of objects from a plurality of sites with survival rates as determined by the survival rate means greater than a predetermined threshold.
A computer readable medium having computer readable program code stored thereon to dynamically pre-tenure new object memory allocation in a generational garbage collector having instructions comprising functionality to:
- initiate a memory collection of a first young generation;
- determine the number of bytes allocated at a plurality of allocation sites that survive collection;
- select a plurality of candidate sites with the highest number of bytes that survive collection from the plurality of allocation sites;
- complete the memory collection of the first young generation;
- initiate a memory collection of a second young generation after the completion of the memory collection of the first young generation;
- determine, for each of the plurality of candidate sites, a survival rate of allocated bytes that survive memory collection;
- and
- store to an older generation in a memory heap a plurality of objects from the plurality of candidates sites with survival rates greater than a predetermined threshold.
Dependencies are inferred from the claim text.