# US 2008/0307174 A1 · Dual Use Memory Management Library

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

- Number: US 2008/0307174 A1
- Document ID: US20080307174A1
- Status: Published application
- Kind: A1
- Application number: 11/760,580
- Filed: 2007-06-08
- Published: 2008-12-11
- Earliest claimed: 2007-06-08
- Assignees: Apple Inc.
- Inventors: Blaine Garst; Bertrand Philippe Serlet
- Web page: https://patentgrep.com/patent/US20080307174A1

## CPC

- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A dual-use library that is able to handle calls from programs requiring either reference count or garbage collected memory management is described. This capability may be provided by introducing a new assignment routine, assign( ), and instrumenting the reference count routines responsible for updating an object's reference count—e.g., addReference( ) and removeReference( ) routines. The assign( ), addReferenc( ) and removeReference( ) routines determine, at runtime, which memory management scheme is appropriate and execute the appropriate instructions (i.e., reference count or garbage collection specific instructions). The described dual-use library provides equivalent functionality as prior art two library implementations, but with a significantly lower memory footprint.

## Claims

### Claim 1

A dual-use library method, comprising:
receiving a first instruction to invoke a first routine;
determining a memory management scheme required by the first instruction;
executing one or more reference-count specific instructions in the first routine if the first instruction requires a reference count memory management scheme; and
executing one or more garbage collector specific memory management instructions in the first routine if the first instruction requires garbage collector memory management.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first routine comprises an assignment routine.

### Claim 3 (depends on 1)

The method of claim 1, wherein the first routine comprises a routine to adjust a counter value, the counter value associated with an object.

### Claim 4 (depends on 3)

The method of claim 3, wherein the counter value tracks how many entities reference the object.

### Claim 5 (depends on 3)

The method of claim 3, wherein the counter value comprises a data structure in a memory.

### Claim 6 (depends on 5)

The method of claim 5, wherein the counter value comprises a plurality of counter values.

### Claim 7 (depends on 1)

The method of claim 1, wherein the reference-count and garbage collector specific memory management instructions comprise compiled instructions.

### Claim 8 (depends on 1)

The method of claim 1, wherein the reference-count and garbage collector specific memory management instructions comprise assembly language instructions.

### Claim 9 (depends on 1)

A program storage device, readable by a programmable control device, comprising instructions stored thereon for causing the programmable control device to perform the method of claim 1.

### Claim 10 (depends on 9)

The program storage device of claim 9, wherein the program storage device comprises random access memory.

### Claim 11 (depends on 10)

The program storage device of claim 10, wherein the random access memory comprises non-volatile random access memory.

### Claim 12 (depends on 11)

The program storage device of claim 11, wherein the non-volatile random access memory comprises a magnetic disk device.

### Claim 13 (depends on 10)

The program storage device of claim 10, wherein the random access memory comprises volatile random access memory.

### Claim 14

A dynamic memory management method, comprising:
receiving, from an entity, a call to a first routine in a runtime library; and
performing a first one or more instructions in the first routine associated with reference count memory management if the entity requires reference count memory management, else
performing a second one or more instructions in the first routine associated with garbage collection memory management if the entity requires garbage collection memory management.

### Claim 15 (depends on 14)

The method of claim 14, wherein the first routine comprises an assignment routine.

### Claim 16 (depends on 1)

The method of claim 1, wherein the first routine comprises a reference count adjustment routine.

### Claim 17 (depends on 14)

A program storage device, readable by a programmable control device, comprising instructions stored thereon for causing the programmable control device to perform the method of claim 14.

### Claim 18 (depends on 1)

A computer system, comprising:
a processor;
a memory coupled to the processor; and
processor executable instructions stored in the memory for causing the processor to perform the method of claim 1.

### Claim 19 (depends on 18)

The computer system of claim 18, wherein the processor executable instructions comprises an operating system level library.

### Claim 20 (depends on 19)

The computer system of claim 19, wherein the operating system level library comprises a shared library.
