Re: autorelease pool
Re: autorelease pool
- Subject: Re: autorelease pool
- From: Hank Heijink <email@hidden>
- Date: Tue, 23 Oct 2007 15:09:56 -0400
Dear Erfan,
From you questions, it is clear that you don't understand how Cocoa
memory management works. I suggest you read the Memory Management Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
index.html
and the Cocoa Fundamentals Guide
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/index.html
Specifically, the chapter on cocoa objects and their life cycle.
On Oct 23, 2007, at 2:34 PM, Erfan Aleemullah wrote:
Yes, I am trying to figure out whether or not I need to use the
release pool
and was throwing the above code out as an example - what I wanted
to know is
**do I need the autorelease pool if the retain count is 1 after the
command
[myObject release]; *
You need an autorelease pool if you're using Cocoa. If you have a
command line application you have to create one yourself, otherwise
the system takes care of it for you.
I need to deallocate memory in my program and release alone isn't
taking the
retain count to 0
Freeing up memory is done with release or autorelease, period.
There's nothing more you should do. However, as far as I know,
checking the retain count is not a reliable method to make sure your
memory is freed. Check the list archives for this, I remember this
has come up a couple of times already.
<snip>
Good luck,
Hank
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden