Patent ID: 8504596

Claim:
A method of managing memory, comprising: receiving an indication that a local object is associated with one or more external objects and storing in a shared data structure an entry indicating that the local object and said one or more external objects are associated with one another, wherein receiving an indication comprises receiving from an application code a call to a method or function configured to make, in response to the call, said entry indicating that the local object and said one or more external objects are associated with one another; determining that the local object local to a first runtime system is associated with said one or more external objects associated with a second runtime system, wherein the determination is based at least in part by a garbage collecting entity associated with the first runtime system reading data stored in the shared data structure, and the shared data structure is accessible by the garbage collecting entity associated with the first runtime system and a garbage collecting entity associated with the second runtime system; retaining the local object, even if the local object has been determined to be unreachable locally in the first runtime system, if at least one of said one or more external objects has been determined by the garbage collection entity associated with the first runtime system to be reachable within the second runtime system by reading from the shared data structure a data stored in the shared data structure by the garbage collecting entity associated with the second runtime system indicating that said at least one of said one or more external objects is reachable in said second runtime system; and deallocating the local object associated with said one or more external objects if the garbage collection entity associated with the first runtime system has determined, by reading from the shared data structure, that none of the external objects are reachable within said second runtime system, wherein said at least one of said one or more external objects is determined by the garbage collecting entity associated with the second runtime system to be reachable in said second runtime system if a reference exists from at least one other object to said at least one of said one or more external objects.