# US 2025/0217285 A1 · Concurrent Lazy Reference Counting In An Old Garbage Collection Generation

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

- Number: US 2025/0217285 A1
- Document ID: US20250217285A1
- Status: Published application
- Kind: A1
- Application number: 18/401,982
- Filed: 2024-01-02
- Published: 2025-07-03
- Earliest claimed: 2024-01-02
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Erik Österlund; Stefan Mats Rikard Karlsson
- Web page: https://patentgrep.com/patent/US20250217285A1

## CPC

- G06F 12/0276: {Generational garbage collection}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 12/0269: {Incremental or concurrent garbage collection, e.g. in real-time systems (G06F12/0261 takes precedence)}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for concurrent lazy reference tracking in an old garbage collection generation are disclosed, including: encountering, by a mutator thread during a garbage collection epoch, a first instruction to write a first value to a field; responsive to encountering the first instruction to write the first value to the field: entering a slow-path write barrier; performing, by the slow-path write barrier, a first one or more reference counting operations with respect to the field; encountering, by the mutator thread during the first garbage collection epoch and subsequent to encountering the first instruction to write the first value to the field, a second instruction to write a second value to the field; responsive to encountering the second instruction to write the second value to the field: entering a fast-path write barrier; wherein the fast-path write barrier does not perform any reference counting operations with respect to the field.

## Claims

### Claim 1

One or more non-transitory computer-readable media storing instructions which, when executed by one or more hardware processors, cause performance of operations comprising:
encountering, by a mutator thread during a first garbage collection epoch, a first instruction to write a first value to a field;
responsive to encountering the first instruction to write the first value to the field: entering a slow-path write barrier;
performing, by the slow-path write barrier, a first one or more reference counting operations with respect to the field;
encountering, by the mutator thread during the first garbage collection epoch and subsequent to encountering the first instruction to write the first value to the field, a second instruction to write a second value to the field;
responsive to encountering the second instruction to write the second value to the field: entering a fast-path write barrier;
wherein the fast-path write barrier does not perform any reference counting operations with respect to the field.

### Claim 2 (depends on 1)

The one or more media of claim 1, wherein the first one or more first reference counting operations comprises:
determining that a remembered set bit is not set for an address of the field;
responsive to determining that the remembered set bit is not set for the address of the field: decrementing a reference count for an object previously referenced by the field.

### Claim 3 (depends on 1)

The one or more media of claim 1, the operations further comprising:
performing, by a garbage collection thread during a second garbage collection epoch, a second one or more reference counting operations with respect to the field.

### Claim 4 (depends on 3)

The one or more media of claim 3, wherein the second one or more first reference counting operations comprises:
determining that a remembered set bit is set for an address of the field;
responsive to determining that the remembered set bit is set for the address of the field: incrementing a reference count for an object previously referenced by the field.

### Claim 5 (depends on 1)

The one or more media of claim 1, the operations further comprising:
clearing, by the slow-path write barrier, a remembered set bit corresponding to an address of the field.

### Claim 6 (depends on 5)

The one or more media of claim 5, the operations further comprising:
performing, by a garbage collection thread during the first garbage collection epoch, remembered set scanning;
wherein the remembered set scanning refrains from scanning an entry corresponding to the remembered set bit cleared by the slow-path write barrier.

### Claim 7 (depends on 1)

The one or more media of claim 1, the operations further comprising:
promoting an object assigned to the field from a first location in a first garbage collection generation to a second location in a second garbage collection generation;
before exposing the object in the second location to mutators, setting a remembered set bit associated with the second location;
wherein setting the remembered set bit associated with the second location prevents reference count decrements associated with the object until a subsequent young mark start.

### Claim 8

A system comprising:
one or more hardware processors;
one or more non-transitory computer-readable media; and
program instructions stored on the one or more non-transitory computer readable media which, when executed by the one or more hardware processors, cause the system to perform operations comprising:
encountering, by a mutator thread during a first garbage collection epoch, a first instruction to write a first value to a field;
responsive to encountering the first instruction to write the first value to the field: entering a slow-path write barrier;
performing, by the slow-path write barrier, a first one or more reference counting operations with respect to the field;
encountering, by the mutator thread during the first garbage collection epoch and subsequent to encountering the first instruction to write the first value to the field, a second instruction to write a second value to the field;
responsive to encountering the second instruction to write the second value to the field: entering a fast-path write barrier;
wherein the fast-path write barrier does not perform any reference counting operations with respect to the field.

### Claim 9 (depends on 8)

The system of claim 8, wherein the first one or more first reference counting operations comprises:
determining that a remembered set bit is not set for an address of the field;
responsive to determining that the remembered set bit is not set for the address of the field: decrementing a reference count for an object previously referenced by the field.

### Claim 10 (depends on 8)

The system of claim 8, the operations further comprising:
performing, by a garbage collection thread during a second garbage collection epoch, a second one or more reference counting operations with respect to the field.

### Claim 11 (depends on 10)

The system of claim 10, wherein the second one or more first reference counting operations comprises:
determining that a remembered set bit is set for an address of the field;
responsive to determining that the remembered set bit is set for the address of the field: incrementing a reference count for an object previously referenced by the field.

### Claim 12 (depends on 8)

The system of claim 8, the operations further comprising:
clearing, by the slow-path write barrier, a remembered set bit corresponding to an address of the field.

### Claim 13 (depends on 12)

The system of claim 12, the operations further comprising:
performing, by a garbage collection thread during the first garbage collection epoch, remembered set scanning;
wherein the remembered set scanning refrains from scanning an entry corresponding to the remembered set bit cleared by the slow-path write barrier.

### Claim 14 (depends on 8)

The system of claim 8, the operations further comprising:
promoting an object assigned to the field from a first location in a first garbage collection generation to a second location in a second garbage collection generation;
after promoting the object and before exposing the object to mutators, setting a remembered set bit associated with the second location;
wherein setting the remembered set bit associated with the second location prevents reference count decrements associated with the object until a subsequent young mark start.

### Claim 15

A method comprising:
encountering, by a mutator thread during a first garbage collection epoch, a first instruction to write a first value to a field;
responsive to encountering the first instruction to write the first value to the field: entering a slow-path write barrier;
performing, by the slow-path write barrier, a first one or more reference counting operations with respect to the field;
encountering, by the mutator thread during the first garbage collection epoch and subsequent to encountering the first instruction to write the first value to the field, a second instruction to write a second value to the field;
responsive to encountering the second instruction to write the second value to the field: entering a fast-path write barrier;
wherein the fast-path write barrier does not perform any reference counting operations with respect to the field;
wherein the method is performed by at least one device including a hardware processor.

### Claim 16 (depends on 15)

The method of claim 15, wherein the first one or more first reference counting operations comprises:
determining that a remembered set bit is not set for an address of the field;
responsive to determining that the remembered set bit is not set for the address of the field: decrementing a reference count for an object previously referenced by the field.

### Claim 17 (depends on 15)

The method of claim 15, further comprising:
performing, by a garbage collection thread during a second garbage collection epoch, a second one or more reference counting operations with respect to the field.

### Claim 18 (depends on 17)

The method of claim 17, wherein the second one or more first reference counting operations comprises:
determining that a remembered set bit is set for an address of the field;
responsive to determining that the remembered set bit is set for the address of the field: incrementing a reference count for an object previously referenced by the field.

### Claim 19 (depends on 15)

The method of claim 15, further comprising:
clearing, by the slow-path write barrier, a remembered set bit corresponding to an address of the field.

### Claim 20 (depends on 19)

The method of claim 19, further comprising:
performing, by a garbage collection thread during the first garbage collection epoch, remembered set scanning;
wherein the remembered set scanning refrains from scanning an entry corresponding to the remembered set bit cleared by the slow-path write barrier.
