You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
689 B
Objective-C

/*
* Category on NSObject to support automatic cycle detection.
*/
@implementation NSObject (CycleDetection)
/**
* Increments the 16-bit reference count. Replaces version that sets a
* one-word reference count.
*/
- (id) retain
{
return GCRetain(self);
}
/**
* Decrements the reference count for an object. If the reference count
* reaches zero, calls -dealloc. If the reference count is not zero then the
* objectt may be part of a cycle. In this case, it is addded to a buffer and
* cycle detection is later invoked.
*/
- (void) release
{
GCRelease(self);
}
/**
* Dealloc now does not free objects, they are freed after -dealloc is called.
*/
- (void) dealloc
{
}
@end