# US 9,355,030 B2 · Parallel garbage collection implemented in hardware

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 9,355,030 B2
- Document ID: US9355030B2
- Status: Granted
- Kind: B2
- Application number: 14/298,532
- Filed: 2014-06-06
- Published: 2015-12-10
- Granted: 2016-05-31
- Earliest claimed: 2014-06-06
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: David F. Bacon; Perry S. Cheng; Sunil K. Shukla
- Web page: https://patentgrep.com/patent/US9355030B2

## CPC

- G06F 12/0261: {using reference counting}
- G06F 9/52: Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F 12/023: {Free address space management}
- G06F 12/0238: {Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory}
- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F 12/0269: {Incremental or concurrent garbage collection, e.g. in real-time systems (G06F12/0261 takes precedence)}
- G06F 12/121: using replacement algorithms
- G06F 2212/1008: Correctness of operation, e.g. memory ordering
- G06F 2212/1016: Performance improvement
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/702: Conservative garbage collection
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

Embodiments of the invention provide a method and system for dynamic memory management implemented in hardware. In an embodiment, the method comprises storing objects in a plurality of heaps, and operating a hardware garbage collector to free heap space. The hardware garbage collector traverses the heaps and marks selected objects, uses the marks to identify a plurality of the objects, and frees the identified objects. In an embodiment, the method comprises storing objects in a heap, each of at least some of the objects including a multitude of pointers; and operating a hardware garbage collector to free heap space. The hardware garbage collector traverses the heap, using the pointers of some of the objects to identify others of the objects; processes the objects to mark selected objects; and uses the marks to identify a group of the objects, and frees the identified objects.

## Claims

### Claim 1

A method for dynamic memory management implemented in hardware, the method comprising:
storing objects in a plurality of heaps; and
operating a hardware garbage collector to free heap space occupied by specified ones of the objects, including:
traversing the plurality of the heaps and marking selected ones of the objects of the heaps based on given criteria; and
using said marks to identify a plurality of the objects, and freeing the identified plurality of objects; wherein:
at least some of the objects include pointers that reference others of the objects;
the pointers of objects in each of the heaps include local pointers and foreign pointers;
the local pointers of each of the heaps point to objects stored in the each heap;
the foreign pointers of each of the heaps point to objects stored in others of the heaps;
each of the single heap mark engines includes a foreign barrier queue for storing the foreign pointers of the one of the heaps that is traversed by the each mark engine, and the each of the mark engines puts the foreign pointers in and removes the foreign pointers from the foreign barrier queue of the each mark engine for processing by others of the mark engines;
using the hardware garbage collector further includes implementing a termination protocol to terminate a mark phase of the garbage collector; and
the implementing a termination protocol includes:
the mark engine of each of the heaps, under defined conditions, asserting a ready to terminate signal to a termination engine;
the termination engine, upon receiving the ready to terminate signals from all the mark engines, broadcasting a start termination signal to all the mark engines;
each of the mark engines, upon receiving the start termination signal, recording an occupancy of the foreign barrier queue of the each mark engine into a termination counter;
in each of the mark engines, decrementing the termination counter of the each mark engine whenever a pointer is removed from the foreign barrier queue of the each mark engine;
each of the mark engines asserting a foreign barrier complete signal to the termination engine when the termination counter of the each mark engine reaches zero;
the termination engine initializing a countdown timer to a predetermined value upon receiving the foreign barrier complete signals from all the mark engines;
aborting the termination protocol if any of the mark engines encounters an unmarked object during the termination protocol; and
declaring the termination protocol complete if the countdown timer reaches 0.

### Claim 2

A method for dynamic memory management implemented in hardware, the method comprising:
storing objects in a heap, each of at least some of the objects including a multitude of pointers that reference others of the objects;
operating a hardware garbage collector to free heap space occupied by specified ones of the objects including:
traversing the heap, including using the multitude of pointers of said at least some of the objects to identify others of the objects of the heap;
processing the objects of the heap to mark selected ones of the objects based on given criteria; and
using said marks to identify a group of the objects to be freed, and freeing the identified group of the objects;
implementing a termination protocol to terminate the mark phase of the mark engine, said termination protocol comprising:
commencing processing of a last unprocessed pointer from the heap;
starting a countdown timer with a count set to a specified logical pipeline depth of the mark engine;
decreasing the count of the countdown timer according to a defined procedure;
coming out of the termination protocol if, before the countdown timer reaches zero, a new work item is generated for the heap; and
declaring termination of the mark phase of the mark engine when the countdown timer reaches zero.
