Re: Will this cause a leak?
Re: Will this cause a leak?
- Subject: Re: Will this cause a leak?
- From: Charilaos Skiadas <email@hidden>
- Date: Wed, 27 Jul 2005 15:34:20 -0500
On Jul 27, 2005, at 1:19 PM, Pontus Ilbring wrote:
On 7/27/05, Zameer Andani <email@hidden> wrote:
I'm a little confused with the concept of autorelease, I've read
all the documentation about the topic that has been posted thus
far in the forum and I find myself still confused. Can someone
perhaps still clarify.
Then read all documentation over here as well:
http://www.cocoadev.com/index.pl?MemoryManagement
And also these two ASAP:
http://www.stepwise.com/Articles/Technical/2001-03-11.01.html
http://www.stepwise.com/Articles/Technical/HoldMe.html
I've said it many times, and I will say it again. Don't think
directly of the retain count. Think of whether you (want to/should)
own the thing or not. new/init/copy/retain and friends (initWith...
etc) make you own it, release/autorelease decrease your ownership of
it. The retain count of the object could be 2534 for all you care, as
long as you've balanced your init/retain... with your release/
autorelease...
In the particular case of the autorelease that you were talking
about, you just told the pool to retain the object while you release
it at the same time, so this guarantees it will stick around at least
until the pool flushes, but you can freely exit your method without
worrying about it. Your job will have been done.
Haris
_______________________________________________
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