Hi,
My question is when a object is actually added to autorelease pool? When a Autorelease pool is created and objects are declared within the scope, are they added in autorelease pool or they are added in pool when specified as autoreleased.
int main(void) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
NSString *string;
NSArray * array;
string = [[[NSString alloc] init] autorelease];
array = [[NSArray alloc] init];
/* use the string */
[pool drain];
}
In this case is only string is added to pool or even array is added to pool?