Re: Am I overreleasing something?
Re: Am I overreleasing something?
- Subject: Re: Am I overreleasing something?
- From: Ondra Cada <email@hidden>
- Date: Fri, 10 Jun 2005 18:53:49 +0200
On 10.6.2005, at 16:44, Glen Simmons wrote:
I suppose the other way is to avoid using autorelease, entirely,
and use release whereever possible. At least that way I'll get my
errors as soon as possible.
Well, there's no way to avoid using autorelease entirely.
There is, of course. You can use Cocoa-Java. Shudder :)
... autorelease is a very useful tool and you would be really
limiting yourself if you tried to do without it.
Definitely.
NSString *foo = [[NSString alloc] initWithFormat:@"%d", myInt];
<more code>
// Sometime later, you have to remember to release foo or
you'll have a memory leak.
Not speaking of that he should also use NS_DURING (or @try) to ensure
that the object does not leak in case of an exception. And, things
like returning an autoreleased object just *can't* be done reasonably
without autorelease (means, each other alternative is much much worse).
So, instead of trying to avoid it, learn how to use it. You'll be a
better programmer for it.
Amen to that.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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