22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
* The OFAutoreleasePool class is a class that keeps track of objects that will
* be released when the autorelease pool is released.
*
* Every thread has its own stack of autorelease pools.
*/
@interface OFAutoreleasePool: OFObject
{
OFAutoreleasePool *next, *prev;
id *objects;
size_t count, size;
}
/**
* Adds an object to the autorelease pool at the top of the thread-specific
* stack.
*
* \param obj The object to add to the autorelease pool
*/
+ (void)addObject: (id)obj;
+ (void)releaseAll;
/**
* Adds an object to the specific autorelease pool.
*
* \param obj The object to add to the autorelease pool
*/
- (void)addObject: (id)obj;
/**
* Releases all objects in the autorelease pool.
*
* This does not free the memory allocated to store pointers to the objects in
* the pool, so reusing the pool does not allocate any memory until the previous
* number of objects is exceeded. It behaves this way to optimize loops that
* always work with the same or similar number of objects and call relaseObjects
* at the end of the loop, which is propably the most common case for
* releaseObjects.
*
* If a garbage collector is added in the future, it will tell the GC that now
* is a good time to clean up, as this is often used after a lot of objects
* have been added to the pool that should be released before the next iteration
* of a loop, which adds objects again. Thus, it is usually a clean up call.
*/
- (void)releaseObjects;
/**
* Releases all objects in the autorelease pool and deallocates the pool.
*/
- (void)release;
/**
* Calling drain is equivalent to calling release.
*
* If a garbage collector is added in the future, it will tell the GC that now
* is a good time to clean up.
*/
- (void)drain;
@end
|
|
|
|
|
|
>
>
|
|
|
|
|
|
|
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
* The OFAutoreleasePool class is a class that keeps track of objects that will
* be released when the autorelease pool is released.
*
* Every thread has its own stack of autorelease pools.
*/
@interface OFAutoreleasePool: OFObject
{
OFAutoreleasePool *nextPool, *previousPool;
id *objects;
size_t count, size;
}
/**
* \brief Adds an object to the autorelease pool at the top of the
* thread-specific autorelease pool stack.
*
* \param object The object to add to the autorelease pool
*/
+ (void)addObject: (id)object;
/// \cond internal
+ (void)releaseAll;
/// \endcond
/**
* \brief Adds an object to the specific autorelease pool.
*
* \param obj The object to add to the autorelease pool
*/
- (void)addObject: (id)object;
/**
* \brief Releases all objects in the autorelease pool.
*
* This does not free the memory allocated to store pointers to the objects in
* the pool, so reusing the pool does not allocate any memory until the previous
* number of objects is exceeded. It behaves this way to optimize loops that
* always work with the same or similar number of objects and call relaseObjects
* at the end of the loop, which is propably the most common case for
* releaseObjects.
*
* If a garbage collector is added in the future, it will tell the GC that now
* is a good time to clean up, as this is often used after a lot of objects
* have been added to the pool that should be released before the next iteration
* of a loop, which adds objects again. Thus, it is usually a clean up call.
*/
- (void)releaseObjects;
/**
* \brief Releases all objects in the autorelease pool and deallocates the pool.
*/
- (void)release;
/**
* \brief Tells the garbage collector that now is a good time to clean up.
*
* If there is no garbage collector, calling drain is equivalent to calling
* release.
*/
- (void)drain;
@end
|