摘要 |
A class in an object oriented system may be made recyclable by inheriting a recycle+571 method from a recyclable class. When automatic garbage collection is attempted on an instance of a class that is recyclable, the garbage collector invokes the recycle+571 method on the instance to determine whether or not the instance should be disposed of by the garbage collector. One or more predetermined recycle criteria are used to determine whether a recyclable instance should, in fact, be recycled. If the instance satisfies the recycle criteria, appropriate recycling logic is executed to cause the instance to be recycled, and the garbage collection of the instance is not performed. If, however, the instance is not recyclable, or if it does not satisfy the recycling criteria, it is disposed of by the garbage collector.
|