Re: memory problem, advice needed
Re: memory problem, advice needed
- Subject: Re: memory problem, advice needed
- From: Ondra Cada <email@hidden>
- Date: Sat, 1 Apr 2006 17:03:28 +0200
Paul,
On 1.4.2006, at 15:53, Paul Gribble wrote:
Yes! This works of course. If I forego the convenience constructors
and use
[[... alloc] initWith...] followed by a [... release]; at the end
of myFun()
all is good in the world. Thanks all for reminding me of this.
Note that
(a) it is somewhat more error-prone, for by separating the allocation
and releasing you increase the possibility of over/underrelease;
(b) if the code between may raise (or leave the scope prematurely in
any other way), you should use an exception harness (and/or other
means) to prevent leak in such a case (an autoreleased object won't
leak, allocated and not-yet-released one of course would).
---
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