Why obj is autoreleased in inner @autoreleasepool block not in outer?
The object is autoreleased in the assignment to obj
(obj = [[NSObject alloc] init];
), so it is put into the topmost (innermost) autorelease pool, and is released when that pool is drained (at the end of the @autoreleasepool
block).
Why NSLog outputs "(null)" if retain count is 1?
_objc_rootRetainCount()
is not a documented function. Apparently _objc_rootRetainCount(nil)
evaluates to 1.