可以说我有以下情况:
- (void)someFunction:(id)param {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSObject *objectA = [[NSObject alloc] init];
[objectA doStuff]; // Don't need to release objectA because of the pool
if (!someValue) {
[pool release]; // Doubt here
return;
}
NSObject *objectB = [[NSObject alloc] init];
[objectB doStuff]; // Don't need to release objectB because of the pool
[pool release];
}
以这种方式从泳池街区内返回是否正确?