发明名称 Garbage collection of an object
摘要 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.
申请公布号 US9390006(B2) 申请公布日期 2016.07.12
申请号 US201213568646 申请日期 2012.08.07
申请人 INTERNATIONAL BUSINESS MACHINES CORPORATION 发明人 Onodera Tamiya;Kawachiya Kiyokuni
分类号 G06F12/00;G06F17/30;G06F12/02;G06F9/445;G06F9/44 主分类号 G06F12/00
代理机构 Cantor Colburn LLP 代理人 Cantor Colburn LLP ;Alexanian Vazken
主权项 1. In a computer system having a plurality of computers each managing its own memory region and conditionally performing garbage collection, a first object placed in a memory of a first computer being remotely referenced by a second object placed in a memory of a second computer, the first computer for executing a first program and a second program, the first object belonging to the first program and not to the second program, a computer implemented method for managing references to the first object, the computer implemented method comprising: creating a first data structure for the first program, wherein the first program does not have a garbage collection mechanism, the first data structure comprising: a first field that stores a reference to the first object when the first data structure is local to the first object and is cleared to null when the first data structure is remotely located from the first object by being copied into the second computer,a second field that stores an identifier of the location of the first object, anda third field that stores an identifier of the first object when the first object is globalized, the identifier being unique within all of the plurality of computers; creating a second data structure for the second program, wherein the second program has a garbage collection mechanism, the second data structure comprising records having the fields of weak reference to the first object, strong reference to the first object, a number of remote references to the first object, and the identifier of the first object; incrementing the number of remote references to the first object when a remote reference is created to the first object and decrementing the number of remote references to the first object when a remote reference to the first object is removed; in response to the number of remote references to the first object being equal to or more than one, placing the reference to the first object in the field of strong reference to avoid a garbage collection of the first object by the garbage collection mechanism of the second program; in response to the number of remote references to the first object being equal to zero, replacing the reference to the first object with a null reference in the field of strong reference to enable garbage collection of the first object, wherein the weak reference continues to point to the first object when the null reference is placed in the field of the strong reference; recognizing the garbage collection of the first object based upon the weak reference; creating a first table for the second program that enables search of the identifier based on the first object; creating second table for the second program that enables search of the first object based on the identifier; registering the first data structure and the second data structure in the first table and in the second table; and deleting the second data structure from the first table and the second table, responsive to recognizing the garbage collection of the first object based upon the weak reference.
地址 Armonk NY US