Re: Am I overreleasing something?
Re: Am I overreleasing something?
- Subject: Re: Am I overreleasing something?
- From: Shawn Erickson <email@hidden>
- Date: Sat, 11 Jun 2005 08:13:24 -0700
On Jun 11, 2005, at 5:00 AM, Theodore H. Smith wrote:
On 10 Jun 2005, at 20:55, Shawn Erickson wrote:
On Jun 10, 2005, at 10:03 AM, Theodore H. Smith wrote:
I didn't quite mean it to that extreme, that would be silly. I
meant more like this within my own code:
Obj = [[MyClass alloc] init];
[Obj doStuff];
[Obj release];
Actually doing the following...
Obj = [[[MyClass alloc] init] autorelease];
[obj doStuff];
...can be safer and cleaner code wise (avoids exit point before
your release causing a leak, etc.). I usually use autorelease
unless I am worried about performance overhead or having a large
object hang around longer then minimally needed.
If you are having problems using autorelease correctly you will
have problems using release correctly (they aren't really that
different). For tracking down bugs use ObjectAlloc.app (OmniGroup
folks also have a good tool called OmniObjectMeter.app) and/or
NSZombie functionality instead of changing away from potentially
good coding practices.
How do I use ObjectAlloc to track down autorelease problems? Is
there a trick for it, or documentation I can read?
Well I haven't looking for any particular documentation on usage I
just sorta know what needs to be done (would have to think about what
I do) but the following outlines some things that can be used.
<http://developer.apple.com/technotes/tn2004/tn2124.html>
Also the following for debugging techniques...
<http://www.cocoadevcentral.com/articles/000066.php>
<http://www.cocoadevcentral.com/articles/000060.php>
-Shawn
[1] ...sounds like a good chance for an article or two on stepwise or
cocoadevcentral.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden