Hardware-protected reference count-based memory management using weak references
AssigneeHiscamp Systems, Inc.
InventorDavid R. Cheriton
Life of this patent
Estimating the term…
Abstract
A method for managing memory, comprising: maintaining a strong reference count for a first object; establishing a first reference from the first object to a second object; establishing a second reference from the second object to the first object, wherein the second reference is a weak reference that does not increase the strong reference count of the first object; detecting that the strong reference count of the first object has reached zero; in response to detecting that the strong reference count has reached zero, invoking a corresponding action.
Claims21
A method for managing memory, comprising:
- maintaining a strong reference count for a first object;
- establishing a first reference from the first object to a second object;
- establishing a second reference from the second object back to the first object, wherein establishing the second reference includes:
- determining whether the first reference from the first object to the second object is a strong reference;
- and
- in the event that the first reference from the first object to the second object is determined to be a strong reference, prohibiting the second reference from the second object back to the first object from being a strong reference and making the second reference a weak reference that does not increase the strong reference count of the first object;
- detecting, using one or more computer processors, that the strong reference count of the first object has reached zero;
- and
- in response to detecting that the strong reference count has reached zero, invoking a corresponding memory management-related action, wherein the corresponding memory management-related action is invoked at least in part by a hardware trap that is invoked in response to detecting that the strong reference count has reached zero.
A computer system, comprising:
- one or more processors configured to:
- maintain a strong reference count for a first object;
- establish a first reference from the first object to a second object;
- establish a second reference from the second object back to the first object, wherein establishing the second reference includes:
- determining whether the first reference from the first object to the second object is a strong reference;
- and
- in the event that the first reference from the first object to the second object is determined to be a strong reference, prohibiting the second reference from the second object back to the first object from being a strong reference and making the second reference a weak reference that does not increase the strong reference count of the first object;
- detect that the strong reference count of the first object has reached zero;
- and
- in response to detecting that the strong reference count has reached zero, invoke a corresponding memory management-related action, wherein the corresponding memory management-related action is invoked at least in part by a hardware trap that is invoked in response to detecting that the strong reference count has reached zero;
- and
- a memory coupled to the processor and configured to provide the processor with instructions.
Dependencies are inferred from the claim text.