Up
Authors
- Richard Frith-Macdonald (
rfm@gnu.org
)
-
Copyright: (C) 2002 Free Software Foundation, Inc.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
Description forthcoming.
Instance Variables
Instance Variables for GCArray Class
@protected id* _contents;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected unsigned int _count;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected BOOL* _isGCObject;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected gcInfo gc;
Description forthcoming.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
Description forthcoming.
Instance Variables
Instance Variables for GCDictionary Class
@protected NSMapTable* _map;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected gcInfo gc;
Description forthcoming.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
Description forthcoming.
Instance Variables
Instance Variables for GCMutableArray Class
@protected id* _contents;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected unsigned int _count;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected BOOL* _isGCObject;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected unsigned int _maxCount;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected gcInfo gc;
Description forthcoming.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
Description forthcoming.
Instance Variables
Instance Variables for GCMutableDictionary Class
@protected NSMapTable* _map;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected gcInfo gc;
Description forthcoming.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
The GCObject class is both the base class for all garbage collected objects, and an infrastructure for handling garbage collection.
It maintains a list of all garbage collectable objects and provides a method to run a garbage collection pass on those objects.
Instance Variables
Method summary
+ (void)
gcCollectGarbage;
Availability: OpenStep
This method runs a garbage collection, causing unreferenced objects to be deallocated. This is done using a simple three pass algorithm -
- Pass 1
-
All the garbage collectable objects are sent a -gcDecrementRefCountOfContainedObjects
message.
- Pass 2
-
All objects having a refCount greater than 0 are sent an -gcIncrementRefCountOfContainedObjects
message.
- Pass 3
-
All the objects that still have the refCount of 0 are part of cyclic graphs and none of the objects from this graph are held by some object outside graph. These objects receive the -dealloc
message. In this method they should send the -dealloc
message to any garbage collectable (GCObject and subclass) instances they contain.
During garbage collection, the +gcIsCollecting
method returns YES
.
+ (BOOL)
gcIsCollecting;
Availability: OpenStep
Returns a flag to indicate whether a garbage collection is in progress.
+ (void)
gcObjectWillBeDeallocated: (
GCObject*)anObject;
Availability: OpenStep
Called to remove anObject from the list of garbage collectable objects.
This method is provided so that classes which are not subclasses of GCObject (but which have the same initial instance variable layout) can use multiple inheritance (behaviors) to act as GCObject instances, but can have their own -dealloc
methods.
These classes should call this in their own -dealloc
methods.
- (void)
gcDecrementRefCount;
Availability: OpenStep
Decrements the garbage collection reference count for the receiver.
- (void)
gcDecrementRefCountOfContainedObjects;
Availability: OpenStep
Marks the receiver as not having been visited in the current garbage collection process (first pass of collection).
All container subclasses should override this method to call the super implementation then decrement the ref counts of their contents as well as sending the -gcDecrementRefCountOfContainedObjects
message to each of them.
- (void)
gcIncrementRefCount;
Availability: OpenStep
Increments the garbage collection reference count for the receiver.
- (BOOL)
gcIncrementRefCountOfContainedObjects;
Availability: OpenStep
Checks to see if the receiver has already been visited in the current garbage collection process, and either marks the receiver as visited (and returns YES
) or returns NO
to indicate that it had already been visited.
All container subclasses should override this method to call the super implementation then, if the method returns YES
, increment the reference count of any contained objects and send the -gcIncrementRefCountOfContainedObjects
to each of the contained objects too.
Instance Variables for GCObject Class
@protected gcInfo gc;
Description forthcoming.
- Declared in:
- GNUstepBase/GCObject.h
Availability: OpenStep
This category implements accessor methods for the instance variables used for garbage collecting. If/when we can ensure that all garbage collecting classes use the same initial ivar layout, we can remove these methods and the garbage collector can access the ivars directly, making a pretty big performance improvement during collecting.
NB. These methods must *only* be used by the garbage collecting process or in methods called from the garbage collector. Anything else is not thread-safe.
Method summary
- (BOOL)
gcAlreadyVisited;
Availability: OpenStep
Description forthcoming.
- (
GCObject*)
gcNextObject;
Availability: OpenStep
Description forthcoming.
- (
GCObject*)
gcPreviousObject;
Availability: OpenStep
Description forthcoming.
- (
GCObject*)
gcSetNextObject: (
GCObject*)anObject;
Availability: OpenStep
Description forthcoming.
- (
GCObject*)
gcSetPreviousObject: (
GCObject*)anObject;
Availability: OpenStep
Description forthcoming.
- (void)
gcSetVisited: (BOOL)flag;
Availability: OpenStep
Description forthcoming.
Up