# US 2012/0254265 A1 · Conservative garbage collecting with concurrent marking and concurrent sweeping for memory management

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

- Number: US 2012/0254265 A1
- Document ID: US20120254265A1
- Status: Published application
- Kind: A1
- Application number: 13/074,226
- Filed: 2011-03-29
- Published: 2012-10-04
- Earliest claimed: 2011-03-29
- Assignees: Microsoft Corporation
- Inventors: Steven Lucco; Curtis Cheng-Cheng Man
- Web page: https://patentgrep.com/patent/US20120254265A1

## CPC

- G06F 12/0269: {Incremental or concurrent garbage collection, e.g. in real-time systems (G06F12/0261 takes precedence)}
- G06F 2212/702: Conservative garbage collection
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Aspects for conservative garbage collecting are disclosed. In one aspect, a heap of objects is generated during an execution of a script, and script objects in an unexecuted portion are traced to corresponding memory locations on the heap. The heap is then marked concurrently with executing the script such that a marked heap includes reachable and unreachable objects. Memory allocated to the unreachable objects is then freed concurrently with executing the script based on the marking. In another aspect, an object graph associated with a call stack is generated and traced such that script objects in an unexecuted portion of the stack are traced to corresponding memory locations on a heap. Heap objects are marked concurrently with executing the stack so that a marked heap includes reachable and unreachable objects. Memory allocated to the unreachable objects is then cleared concurrently with executing the stack based on the marked heap.

## Claims

### Claim 1

A method, comprising:
generating a heap of objects during an execution of a script;
tracing script objects included in an unexecuted portion of the script to a corresponding set of memory locations on the heap;
marking at least a portion of the heap concurrently with the execution of the script, wherein a marked heap includes reachable objects reachable by the unexecuted portion of the script, and wherein the marked heap further includes unreachable objects unreachable by the unexecuted portion of the script; and
freeing memory allocated to the unreachable objects, wherein the freeing is based on the marking and performed concurrently with the execution of the script.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the marking comprises marking the reachable objects.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the marking comprises marking the unreachable objects.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the freeing comprises respectively preserving the reachable objects in original storage locations of the heap.

### Claim 5 (depends on 4)

The method according to claim 4, wherein the preserving comprises maintaining a separation of heap objects according to a fixed set of boundaries within the heap.

### Claim 6 (depends on 1)

The method according to claim 1, further comprising executing the script.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the executing comprises compiling a javascript.

### Claim 8 (depends on 6)

The method according to claim 6, wherein the executing comprises modifying a document object model.

### Claim 9

A memory management device, comprising:
a memory having computer executable components stored thereon; and
a processor communicatively coupled to the memory, the processor configured to execute the computer executable components, the computer executable components comprising:
a heap component configured to generate a heap of objects during an execution of a script;
a tracing component configured to trace script objects included in an unexecuted portion of the script to a corresponding set of memory locations on the heap;
a marking component configured to mark at least a portion of the heap concurrently with the execution of the script, wherein a marked heap includes reachable objects reachable by the unexecuted portion of the script, and wherein the marked heap further includes unreachable objects unreachable by the unexecuted portion of the script; and
a recycling component configured to free memory allocated to the unreachable objects according to the marked heap, wherein the recycling component is further configured to free the memory concurrently with the execution of the script.

### Claim 10 (depends on 9)

The memory management device of claim 9, wherein the marking component is configured to mark only one of the reachable objects or the unreachable objects.

### Claim 11 (depends on 9)

The memory management device of claim 9, wherein the recycling component is configured to recycle a portion of the memory allocated to the unreachable objects prior to a freeing of an entire portion of the memory allocated to the unreachable objects.

### Claim 12 (depends on 9)

The memory management device of claim 9, wherein the recycling component is configured to respectively preserve reachable objects in original storage locations of a heap.

### Claim 13 (depends on 12)

The memory management device of claim 12, wherein the recycling component is configured to maintain a separation of heap objects according to a fixed set of boundaries within the heap.

### Claim 14 (depends on 9)

The memory management device of claim 9, further comprising an execution component configured to execute the script.

### Claim 15 (depends on 14)

The memory management device of claim 14, further comprising a compilation component configured to compile a javascript.

### Claim 16 (depends on 14)

The memory management device of claim 14, further comprising a component configured to modify a document object model based on the execution of the script.

### Claim 17

A computer-readable storage medium, comprising computer-readable instructions, the computer-readable instructions including instructions for causing at least one computing device including a processor to perform operations, comprising:
generating an object graph associated with a call stack;
tracing the object graph, wherein script objects included in an unexecuted portion of the call stack are traced to a corresponding set of memory locations on a heap;
marking heap objects concurrently with an execution of the call stack, wherein a marked heap includes reachable objects reachable by the unexecuted portion of the call stack, and wherein the marked heap further includes unreachable objects unreachable by the unexecuted portion of the call stack; and
clearing memory allocated to the unreachable objects, wherein the memory is cleared concurrently with the execution of the call stack based on the marked heap.

### Claim 18 (depends on 17)

The computer-readable storage medium according to claim 17, wherein the computer-readable instructions further include instructions for recycling a portion of the memory allocated to the unreachable objects.

### Claim 19 (depends on 18)

The computer-readable storage medium according to claim 18, wherein the recycling is performed prior to a freeing of an entire portion of the memory allocated to the unreachable objects.

### Claim 20 (depends on 17)

The computer-readable storage medium according to claim 17, wherein the clearing comprises respectively preserving a storage of the reachable objects in original memory locations on the heap.
