Re: trivial question
Re: trivial question
- Subject: Re: trivial question
- From: publiclook <email@hidden>
- Date: Fri, 20 Jun 2003 20:27:10 -0400
On Thursday, June 19, 2003, at 08:36 PM, Nick Hristov wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello.
When I send a messages to NSDictionary, allKeys and allValues, do I
get an autoreleased object, with ref. count. 1 (i.e. it is not a
temporary object)?
That is the proper and expected Cocoa memory handling procedure...
Do the methods -allKeys and -allValues contain the word alloc ?
Did you retain the values returned from -allKeys and -allValues ?
If the answer to both questions is NO then you don't have to worry
about ever releasing or autoreleasing the objects. They will go away
by themselves at some appropriate time after the code that called
-allKeys or -allValues leaves scope.
If you want to keel the values around beyond the scope of the calling
code then you MUST retain the values and release or autorelease them
sometime later.
Is that clear ?
reference any of the numerous web articles on the subject. I like the
ones at www.stepwise.com.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.