Memory management in a partially garbage-collected programming system
First Claim
1. A cross-language memory management system for use in an object oriented programming environment, comprising:
- an explicit memory management domain in which reference counting is used to reclaim memory blocks;
an implicit memory management domain in which garbage collection is used to reclaim memory blocks; and
interface mechanism connecting the explicit memory management domain and the implicit memory management domain for detecting cross-language references between the explicit and implicit memory management domains intended for implementation objects in said domains and, in the case of any implementation object in the implicit memory management domain targeted by an existing cross-language reference from the explicit memory management domain, maintaining at least one strong reference to that implementation object.
0 Assignments
0 Petitions
Accused Products
Abstract
Memory management to support calls between objects in language environments support automatic garbage collection and language environments requiring explicit control of object destruction is provided. Reference counting is used to automatically control the lifetime of objects requiring explicit destruction and that are to be accessible across the language boundary. A data structure is maintained in a runtime component for each object that is accessed over a language boundary. The reference count for each non-garbage collected object is incremented by the runtime in accordance with the number of cross-language references held to it. When the count reaches zero through decrements as the references are returned and destroyed, the non-garbage collected object can be safely and automatically destroyed. The runtime creates a strong reference to any garbage collected object accessed by a cross-language call. The reference is visible to the garbage collector, and prevents the object being collected while the reference is in existence.
-
Citations
19 Claims
-
1. A cross-language memory management system for use in an object oriented programming environment, comprising:
- an explicit memory management domain in which reference counting is used to reclaim memory blocks;
an implicit memory management domain in which garbage collection is used to reclaim memory blocks; and
interface mechanism connecting the explicit memory management domain and the implicit memory management domain for detecting cross-language references between the explicit and implicit memory management domains intended for implementation objects in said domains and, in the case of any implementation object in the implicit memory management domain targeted by an existing cross-language reference from the explicit memory management domain, maintaining at least one strong reference to that implementation object. - View Dependent Claims (2, 3, 4)
- an explicit memory management domain in which reference counting is used to reclaim memory blocks;
-
5. In an object oriented programming environment permitting cross-language invocations from an explicit memory management domain in which reference counting is used to destroy objects and reclaim memory blocks to an implicit memory management domain in which garbage collection is used to destroy objects and reclaim memory blocks, a mechanism to control object destruction, comprising:
-
means for passing a strong reference from a calling object in the explicit memory management domain to an implementation object called by the calling object in the implicit memory management domain; and
means for destroying the strong reference upon destruction of the calling object. - View Dependent Claims (6, 7)
the proxy object is in the explicit memory management domain and includes a reference counter adapted to count invocations on the proxy object; and
wherein the means to destroy the strong reference comprise explicit memory management routines when the reference counter in the proxy object is zero.
-
-
8. In an object oriented programming environment permitting cross-language invocations from an implicit memory management domain in which garbage collection is used to destroy objects and reclaim memory blocks to an explicit memory management domain in which reference counting is used to destroy objects and reclaim memory blocks, a mechanism to control object destruction, comprising:
-
means for incrementing a reference count in an implementation object in the explicit memory management domain invoked by a calling object in the implicit memory management domain;
means for returning a weak reference to the calling object; and
means for decrementing the reference count upon destruction of the calling object. - View Dependent Claims (9, 10)
-
-
11. A method for implementing a cross-language call from a client between an implicit memory management domain in which garbage collection is used to reclaim memory blocks and an explicit memory management domain in which reference counting is used to reclaim memory blocks, comprising:
-
invoking a method for the call on a proxy object permitting cross-language access;
converting the method to a language-independent token having a reference count of at least one;
selecting a pointer for invoking an implementation side mechanism; and
receiving a return value at the client. - View Dependent Claims (12, 13, 14)
receiving as a return value a reference to a cross-language object;
incrementing a reference count in a language-independent token for the cross-language object;
converting the return value to the language-independent token; and
locating a proxy for the reference to the cross-language object.
-
-
13. A method, according to claim 12, wherein the step of locating a proxy for the cross-language object comprises:
-
locating an existing proxy for the cross-language object and decrementing the reference count in the language-independent token for the cross-language object;
or, if no proxy currently exists for the cross-language object, creating a proxy.
-
-
14. A method, according to claim 12 further comprising implementing memory management when the client releases the proxy object permitting cross-language access, including the steps of:
-
decrementing the reference count in the language-independent token when the proxy object is destroyed; and
destroying the language-independent token when its reference count reaches zero, thereby destroying the pointer to the implementation side mechanism.
-
-
15. A computer program product for implementing a call from an client between a programming environment in which garbage collection is used to reclaim memory blocks and an implementation in a programming environment in which garbage collection is not used to reclaim memory blocks, said computer program product comprising:
-
a computer readable storage medium having computer readable code means embodied in said medium, said computer readable code means comprising;
computer instruction means for invoking a method for the call on a proxy object permitting cross-language access;
computer instruction means for converting the method to a language-independent token having a reference count of at least one;
computer instruction means for selecting a pointer for invoking an implementation side mechanism; and
computer instruction means for receiving a return value at the client.
-
-
16. A composite object constructed over at least first and second object oriented language environments, one of said environments having explicit memory management using reference counting to reclaim memory blocks and the other one of said environments having implicit memory management using garbage collection to reclaim memory blocks, comprising:
-
a first class hierarchy for the composite object constructed in the first environment having a proxy base class and at least one derived implementation object;
a second class hierarchy for the composite object constructed in the second environment having a base implementation class and at least one proxy derived class; and
an interface mechanism for detecting a cross-language reference from a proxy class in the composite object and to select a pointer to a corresponding implementation class;
wherein when a method invoked on the composite object in one of the language environments executes on a proxy class, that proxy class invokes a cross-language method on its corresponding implementation class in the second environment. - View Dependent Claims (17, 18, 19)
-
Specification