Re: Am I overreleasing something?
Re: Am I overreleasing something?
- Subject: Re: Am I overreleasing something?
- From: "Theodore H. Smith" <email@hidden>
- Date: Sat, 11 Jun 2005 13:00:48 +0100
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?
--
http://elfdata.com/plugin/ Industrial strength string processing,
made easy.
"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."
_______________________________________________
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