Re: literal strings - who do they belong to?
Re: literal strings - who do they belong to?
- Subject: Re: literal strings - who do they belong to?
- From: Wade Tregaskis <email@hidden>
- Date: Mon, 13 Jul 2009 18:07:44 -0700
There's also a high cost, in CPU cycles and memory, to retain/
[auto]release in such an excessively defensive way. And have fun
using Object Alloc to find real problems once you've added these
superfluous retain/release/autoreleases to every return value in
your entire program.
But wouldn't adding those retain/autoreleases to every accessor in
your entire program have the same effect?
Perhaps to an extent, if the object in question lives a long time
relative to the number of gets of it. But in any case, the same
object may be passed down a very long callstack, so the difference
could be between a single retain]autorelease] and a thousand of them.
It's still easier to interpret in tools like Object Alloc, though -
you can clearly see the retain]autorelease] for each getter scattered
throughout other uses. The periods you're most interested in are
likely to be between calls to the getter (on the same thread, at
least), and so much less noisy.
Wade
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden