Garbage collection of an object
Abstract
One or more embodiments are directed to creating a structure comprising a weak reference to an object, a strong reference to the object, a count of remote references to the object, and an identifier for the object, incrementing the count when a remote reference is created to the object and decrementing the count when a remote reference is removed, setting the strong reference in response to the count being greater than a first threshold in order to avoid a garbage collection of the object, clearing the strong reference in response to the count being less than a second threshold to enable a garbage collection of the object, and removing the structure and related resources based on a recognition of the object's collection through the weak reference.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . An apparatus for performing garbage collection comprising:
at least one processor; and memory having instructions stored thereon that, when executed by the at least one processor, cause the apparatus to:
create a structure comprising: a weak reference to an object, a strong reference to the object, a count of remote references to the object, and an identifier for the object,
increment the count when a remote reference is created to the object and decrement the count when a remote reference is removed,
set the strong reference in response to the count being greater than a first threshold in order to avoid a garbage collection of the object,
clear the strong reference in response to the count being less than a second threshold to enable a garbage collection of the object, and
remove the structure and related resources based on a recognition of the object's collection through the weak reference.
2 . The apparatus of claim 1 , wherein the first threshold is equal to zero and wherein the second threshold is equal to one.
3 . The apparatus of claim 1 , wherein the instructions, when executed by the at least one processor, cause the apparatus to:
store a first link to the structure to enable a lookup of the identifier based on the weak reference, and store a second link to the structure to enable a lookup of the structure based on the identifier.
4 . The apparatus of claim 3 , wherein the first link is associated with a first table that maps a plurality of structures to a corresponding plurality of unique identifiers, and wherein the second link is associated with a second table that maps the plurality of unique identifiers to the plurality of structures.
5 . The apparatus of claim 1 , wherein the instructions, when executed by the at least one processor, cause the apparatus to:
garbage collect the object based at least in part on a determination that the strong reference is cleared.
6 . The apparatus of claim 1 , wherein the instructions, when executed by the at least one processor, cause the apparatus to:
garbage collect the object using a local garbage collection mechanism.
7 . The apparatus of claim 6 , wherein the local garbage collection mechanism comprises a Java garbage collection mechanism.
8 . A system for performing garbage collection comprising:
a computing device configured to store an object and a structure, the structure comprising: a weak reference to the object, a strong reference to the object, a count of remote references to the object, and a unique identifier to the object; the computing device is configured to garbage collect the object when the count of remote references is less than a first threshold and when the number of local references to the object in the computing device is less than a second threshold.
9 . The system of claim 8 , wherein the computing device is configured to increment the count of remote references when a remote reference to the object is created and decrement the count of remote references when a remote reference to the object is removed.
10 . The system of claim 8 , wherein the first threshold is equal to one, and wherein the second threshold is equal to one.
11 . The system of claim 8 , wherein the computing device is configured to garbage collect the object via a distributed programming language running on Java virtual machines without modifying the Java.
12 . The system of claim 11 , wherein the distributed programming language comprises X10 programming language.
13 . The system of claim 8 , wherein the computing device comprises at least one of a personal computer, a laptop computer, a mobile device, and a server.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.