Re: NSString Retain Count of 2147483647
Re: NSString Retain Count of 2147483647
- Subject: Re: NSString Retain Count of 2147483647
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 24 Jun 2009 12:26:19 -0500
On Jun 24, 2009, at 12:05 PM, Thomas Wetmore wrote:
Retain counts are not magical, and though we poor developers may not
know the underlying details of everything the frameworks do with
them, it is not hard, when applying adult-level reasoning skills, to
use them to help debug sticky situations. They are not complicated
things no matter what Apple might do in special cases. The
admonitions from some that asking such questions or peeking at
retain counts is off-limits or oh-my-god things might change in the
future so stay away, seems fairly close-minded to me. Since so many
of you felt obliged to give me advice, let me give you some -- be
willing to think and stay off slippery hobby horses.
If you have had luck using -retainCount to debug something, that's
just grand. Bully for you!
But recommending -retainCount as a useful tool to anyone new to the
platform is counter-productive.
There are better tools and techniques available that aren't rife with
weird special cases that cause mass confusion (as is evidenced by the
fact that questions along the lines of "Why does my retain count show
as X when I think it should be Y?" or "What do some NSNumbers have a
retain count of 2-zillion while others don't?" come up pretty much
every other week.
The specific retain count of any given object is an implementation
detail of that object and of all APIs that said object has passed
through. The only true maxim regarding the retain count is one of
deltas; every time you implicitly or explicitly cause the retain
count to increase, you must balance it with an explicit or implicit
release (or autorelease).
Hopefully, -retainCount will be deprecated in some near future release
and removed entirely in a release not long thereafter.
b.bum
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden