• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: trivial question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
References: 
 >trivial question (From: Nick Hristov <email@hidden>)

  • Prev by Date: Re: Use libcddb in my Cocoa App
  • Next by Date: Re: Not a drawer but a ... ?
  • Previous by thread: trivial question
  • Next by thread: Re: trivial question
  • Index(es):
    • Date
    • Thread