Patent ID: 8838656

Claim:
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.