Patent · US6038572A · A · US
Method and apparatus for localizing nodes in a garbage collected carded heap
- (11) Publication number
- US6038572A
- (21) Application number
- 08/842,070
- (22) Filing date
- 1997-04-23
- (30) Priority date
- 1997-04-23
- (43) Publication date
- 2000-03-14
- (45) Date of grant
- 2000-03-14
- (51) IPC
- G06F 12/02
- (52) CPC
- (73) Assignee
- Sun Microsystems Inc
- (72) Inventors
- David C. Schwartz; Ross C. Knippel
- (54) Title
- Method and apparatus for localizing nodes in a garbage collected carded heap
- (57) Abstract
Apparatus, methods, systems and computer program products are disclosed describing processes that optimize generational garbage collection techniques in a card-marked heap. The invention localizes nodes in an older generation that have a pointer to a newer generation. This node localization increases the density of such nodes in the cards marked as having these nodes and thus reduces the number of marked cards that need to be examined for nodes having pointers to the newer generation.
- Full text
- View on Google Patents
Claims (16)
- A computer controlled method for localizing a first plurality of nodes in a card-marked older generation heap area, each of said first plurality of nodes containing a pointer to an address in a younger generation heap area, said card-marked older generation heap area having an intermixed plurality of nodes of said first plurality of nodes with a second plurality of remaining nodes, wherein said method comprises steps of: (a) collecting said first plurality of nodes to a card-marked copied generation; and (b) collecting said second plurality of remaining nodes to said card-marked copied generation.
- The computer controlled method of claim 1 wherein step (a) comprises steps of: (a1) iterating over said intermixed plurality of nodes; (a2) remembering said second plurality of remaining nodes; and (a3) copying each of said first plurality of nodes to said card-marked copied generation.
- The computer controlled method of claim 2 wherein step (b) comprises steps of: (b1) iterating over said second plurality of remaining nodes; and (b2) copying each of said second plurality of remaining nodes to said card-marked copied generation.
- The computer controlled method of claim 2 wherein step (a) further comprises marking a card marker in said card-marked copied generation.
- A computer controlled system having a central processing unit (CPU) and a memory coupled to said CPU, for localizing a first plurality of nodes in a card-marked older generation heap area of said memory, each of said first plurality of nodes containing a pointer to an address in a younger generation heap area of said memory, said card-marked older generation heap area having an intermixed plurality of nodes of said first plurality of nodes with a second plurality of remaining nodes, wherein said system comprises: a first collection mechanism configured to collect said first plurality of nodes to a card-marked copied generation in said memory; and a second collection mechanism configured to collect said second plurality of remaining nodes to said card-marked copied generation.
- The computer controlled system of claim 5 wherein the first collection mechanism comprises: a first iteration mechanism configured to iterate over said intermixed plurality of nodes; a storage mechanism configured to remember said second plurality of remaining nodes; and a first copy mechanism configured to copy each of said first plurality of nodes to said card-marked copied generation.
- The computer controlled system of claim 6 wherein the second collection mechanism comprises: a second iteration mechanism configured to iterate over said second plurality of remaining nodes; and a second copy mechanism configured to copy each of said second plurality of remaining nodes to said card-marked copied generation.
- The computer controlled system of claim 6 wherein the first collection mechanism further comprises a card marking mechanism configured to mark a card marker in said card-marked copied generation.
- An apparatus having a central processing unit (CPU) and a memory coupled to said CPU for localizing a first plurality of nodes in a card-marked older generation heap area of said memory, each of said first plurality of nodes containing a pointer to an address in a younger generation heap area of said memory, said card-marked older generation heap area having an intermixed plurality of nodes of said first plurality of nodes with a second plurality of remaining nodes, wherein said system comprises: a first collection mechanism configured to collect said first plurality of nodes to a card-marked copied generation in said memory; and a second collection mechanism configured to collect said second plurality of remaining nodes to said card-marked copied generation.
- The apparatus of claim 9 wherein the first collection mechanism comprises: a first iteration mechanism configured to iterate over said intermixed plurality of nodes; a storage mechanism configured to remember said second plurality of remaining nodes; and a first copy mechanism configured to copy each of said first plurality of nodes to said card-marked copied generation.
- The apparatus of claim 10 wherein the second collection mechanism comprises: a second iteration mechanism configured to iterate over said second plurality of remaining nodes; and a second copy mechanism configured to copy each of said second plurality of remaining nodes to said card-marked copied generation.
- The apparatus of claim 10 wherein the first collection mechanism further comprises a card marking mechanism configured to mark a card marker in said card-marked copied generation.
- A computer program product comprising: a computer usable storage medium having computer readable code embodied therein for causing a computer to locate a first plurality of nodes in a card-marked older generation heap area, each of said first plurality of nodes containing a pointer to an address in a younger generation heap area, said card-marked older generation heap area having an intermixed plurality of nodes of said first plurality of nodes with a second plurality of remaining nodes, said computer readable code comprising: computer readable program code devices configured to cause said computer to effect a first collection mechanism configured to collect said first plurality of nodes to a card-marked copied generation; and computer readable program code devices configured to cause said computer to effect a second collection mechanism configured to collect said second plurality of remaining nodes to said card-marked copied generation.
- The computer program product of claim 13 wherein the first collection mechanism comprises: computer readable program code devices configured to cause said computer to effect a first iteration mechanism configured to iterate over said intermixed plurality of nodes; computer readable program code devices configured to cause said computer to effect a storage mechanism configured to remember said second plurality of remaining nodes; and computer readable program code devices configured to cause said computer to effect a first copy mechanism configured to copy each of said first plurality of nodes to said card-marked copied generation.
- The computer program product of claim 14 wherein the second collection mechanism comprises: computer readable program code devices configured to cause said computer to effect a second iteration mechanism configured to iterate over said second plurality of remaining nodes; and computer readable program code devices configured to cause said computer to effect a second copy mechanism configured to copy each of said second plurality of remaining nodes to said card-marked copied generation.
- The computer program product of claim 14 wherein the first collection mechanism further comprises computer readable program code devices configured to cause said computer to effect a card marking mechanism configured to mark a card marker in said card-marked copied generation.
Description
1. Field of the Invention
This invention relates to the field of computer memory allocation and deallocation. Specifically this invention is a new and useful method, apparatus, system and computer program product for performing generational garbage collection.
2. Background
Memory allocation and deallocation techniques have become very important in structured programming and object oriented programming methodologies. Memory allocated from a heap can be used to store information. Often this information is an instantiated object within an object-oriented paradigm. The subsequently described techniques apply to both nodes in the heap containing data and nodes in the heap that are instantiated objects.
Computer memory is a resource. Programs cause a computer to perform operations (to execute) based on instructions stored in memory. Executing programs also use memory to store information. This information is often organized into memory resident data structures. Usually, these data structures are linked together by pointers from one structure to another referenced through pointers in static and stack variable storage. The memory resource is managed to meet the storage requirements for information and program code.
Executing programs often need memory for a purpose that extends for a limited period of time. For example, a program may allocate memory to hold information, store the information into the allocated memory, operate on the stored information to produce a result, and then have no further need of the stored information.
Citations (22)
- US4922414A
- US4757438A
- US4775932A
- US4920483A
- US5222221A
- US4989134A
- US5136706A
- US4907151A
- US5088036A
- US5321834A
- US5301288A
- US5535329A
- US5355483A
- US5218698A
- US5561786A
- US5560003A
- US5367685A
- US5408650A
- US5566321A
- US5379431A
- US5574915A
- US5590332A