Ephemeral garbage collection using a tracking mechanism on a card table to determine marked bundles
First Claim
1. A computer-readable storage medium apparatus having computer-executable instructions encoded thereon to support ephemeral garbage collection by setting a write-watch mechanism to watch specified memory locations, the computer-readable storage medium apparatus being accessible by a computing device, the instructions, upon execution, causing the computing device, during execution of a program, when a statement of the program for execution is obtained, to determine whether the statement includes a store operator, the instructions, upon execution, further causing the computing device to perform operations comprising:
- during a loop that is performed for at least two iterations based at least on respective store operators;
storing a value specified in the statement in a memory location specified in the statement;
determining whether the memory location specified is within an ephemeral generation;
in an event the memory location specified is within the ephemeral generation, obtaining a next statement of the program for execution; and
in an event the memory location specified is not within the ephemeral generation, setting a card associated with the memory location specified and obtaining the next statement of the program for execution;
requesting via the write-watch mechanism a list of memory locations, the list;
identifying a plurality of the memory locations that have been accessed since a last ephemeral garbage collection process, each memory location corresponding to one of a plurality of cards associated with one or more objects allocated from within a memory heap, each of the plurality of cards associated with a card table, wherein the card table identifies one or more of the plurality of cards with objects that have been accessed; and
comprising a bitmap, wherein each bit within the bitmap corresponds to one of the plurality of cards, modification of the bitmap occurring when a corresponding bit is set at the time that the card is trimmed to disk;
creating, during the current ephemeral garbage collection process and responsive to exiting the loop upon encountering a statement lacking a store operator, a bundle table containing entries identifying a plurality of bundles, wherein each of the plurality of bundles identifies groupings of subsets of the plurality of cards;
marking, outside of the loop including setting the card, during the current ephemeral garbage collection process, two or more of the plurality of bundles identified in the bundle table using the list, wherein the marked bundles identify groupings of subsets of the plurality of marked cards having associated objects that have been accessed since the last ephemeral garbage collection process; and
performing garbage collection upon at least one accessed object.
2 Assignments
0 Petitions
Accused Products
Abstract
The techniques and mechanisms described herein are directed to a system for performing garbage collection on a large heap that is divided into several cards which are grouped into bundles. The techniques include initiating a write-watch mechanism to track accesses to a card table that identifies marked cards. The write-watch mechanism provides a list of the written card table locations to a garbage collection process which determines marked bundles based on the list. For each marked bundle, the marked cards within the marked bundle are scanned to identify the accessed objects. The accessed objects are then collected. Because determining the marked bundles is performed at the start of the garbage collection process and not whenever the memory locations within the bundle are accessed, the present technique reduces the overhead associated with bundle marking and allows the efficiency of the garbage collection process to be less dependent on heap size.
93 Citations
24 Claims
-
1. A computer-readable storage medium apparatus having computer-executable instructions encoded thereon to support ephemeral garbage collection by setting a write-watch mechanism to watch specified memory locations, the computer-readable storage medium apparatus being accessible by a computing device, the instructions, upon execution, causing the computing device, during execution of a program, when a statement of the program for execution is obtained, to determine whether the statement includes a store operator, the instructions, upon execution, further causing the computing device to perform operations comprising:
-
during a loop that is performed for at least two iterations based at least on respective store operators; storing a value specified in the statement in a memory location specified in the statement; determining whether the memory location specified is within an ephemeral generation; in an event the memory location specified is within the ephemeral generation, obtaining a next statement of the program for execution; and in an event the memory location specified is not within the ephemeral generation, setting a card associated with the memory location specified and obtaining the next statement of the program for execution; requesting via the write-watch mechanism a list of memory locations, the list; identifying a plurality of the memory locations that have been accessed since a last ephemeral garbage collection process, each memory location corresponding to one of a plurality of cards associated with one or more objects allocated from within a memory heap, each of the plurality of cards associated with a card table, wherein the card table identifies one or more of the plurality of cards with objects that have been accessed; and comprising a bitmap, wherein each bit within the bitmap corresponds to one of the plurality of cards, modification of the bitmap occurring when a corresponding bit is set at the time that the card is trimmed to disk; creating, during the current ephemeral garbage collection process and responsive to exiting the loop upon encountering a statement lacking a store operator, a bundle table containing entries identifying a plurality of bundles, wherein each of the plurality of bundles identifies groupings of subsets of the plurality of cards; marking, outside of the loop including setting the card, during the current ephemeral garbage collection process, two or more of the plurality of bundles identified in the bundle table using the list, wherein the marked bundles identify groupings of subsets of the plurality of marked cards having associated objects that have been accessed since the last ephemeral garbage collection process; and performing garbage collection upon at least one accessed object. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A method for executing statements within a program to support ephemeral garbage collection by setting a write-watch mechanism to watch specified memory locations such that during execution of a program, when a statement of the program for execution including a store operator is obtained, a computing device performs the method comprising:
-
specifying a range of card table memory to watch during program execution by calling a write-watch mechanism that; performs tracking of access to the card table memory; and maintains a write-watch list that identifies cards marked within the card table memory since a garbage collection process was last performed, each card being associated with and updated upon access to one or more objects allocated within a memory heap, the memory heap being divided into a plurality of cards with each card being grouped into one of a plurality of bundles, wherein one of the plurality of bundles corresponds to a subset of that plurality of cards that are tracked using a page of card table memory outside of a loop that is traversed at least twice based on a respective number of store operators including marking at least one of the plurality of cards; during the loop including marking at least one of the plurality of cards, in an event the statement obtained has one of the store operators; storing a value within the memory heap at a memory location specified by the statement obtained; determining whether the memory location specified is within an ephemeral generation; in an event the memory location specified is within the ephemeral generation, obtaining a next statement of the program for execution; and in an event the memory location specified is not within the ephemeral generation, marking the at least one of the plurality of cards within the card table memory corresponding to the memory location and obtaining a next statement of the program for execution. - View Dependent Claims (13, 14, 15, 16, 17, 18)
-
-
19. A memory management system that sets a write-watch mechanism to watch specified memory locations during execution of a program, obtain a statement of the program for execution, and determine whether the statement obtained includes a store operator, the system comprising:
-
a processor; a memory into which a plurality of instructions are loaded and into which a plurality of objects are dynamically allocated, the memory having a heap into which the objects are allocated, the heap being divided into a plurality of cards which are grouped into a plurality of bundles, each card being associated with one or more of the plurality of objects, wherein upon execution of the plurality of instructions by the processor, the system, based at least on whether the store operator is included in the statement for execution obtained, performs an operation such that; in an event the statement obtained does not have a store operator, executing the statement; and in an event the statement obtained has a store operator performing at least two iterations of a loop including; storing a value specified in the statement obtained in a memory location specified in the statement obtained; determining whether the memory location specified is within an ephemeral generation; in an event the memory location specified is within the ephemeral generation, obtaining a next statement of the program for execution; and in an event the memory location specified is not within the ephemeral generation, setting a card associated with the memory location specified and obtaining the next statement of the program for execution; and the write-watch mechanism that identifies cards that have been set in the memory location specified since a garbage collection process was last performed, the plurality of cards being grouped into one of the plurality of bundles, and a corresponding bundle of the plurality of bundles that have been marked outside of the loop based at least on encountering a statement not having a store operator including setting the card. - View Dependent Claims (20, 21, 22, 23, 24)
-
Specification