I want to print retain count of NSString
in AppDelegate
class in didFinishLaunchingWithOptions
method
NSString *str = [[N
Apple docs say:
Special Considerations
This method is of no value in debugging memory management issues. Because any number of framework objects may have retained an object in order to hold references to it, while at the same time autorelease pools may be holding any number of deferred releases on an object, it is very unlikely that you can get useful information from this method.
So you shouldn't count on its correctness.
Also, -1
is actually largest unsigned integer, not negative value. Retain count returns NSUInteger
, so you should use %u
instead of %d
.