• 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: NSMutableArray, NSMutableDictionary memory managment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray, NSMutableDictionary memory managment


  • Subject: Re: NSMutableArray, NSMutableDictionary memory managment
  • From: Jamie Hardt <email@hidden>
  • Date: Thu, 11 Sep 2008 10:18:14 -0700
  • Resent-date: Thu, 11 Sep 2008 10:18:56 -0700
  • Resent-from: Jamie Hardt <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: Cocoa Developers <email@hidden>

All of the collection classes -retain and -release objects that are added to them, so you can release them in your code and as long as you are retaining or otherwise holding onto the collection itself, the collection will keep a strong ref to the objects it holds.

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/Reference/Reference.html

"Arrays maintain strong references to their contents—in a managed memory environment, each object receives a retain message before its id is added to the array and a release message when it is removed from the array or when the array is deallocated. If you want a collection with different object ownership semantics, consider using CFArray Reference, NSPointerArray, or NSHashTable instead."

On Sep 11, 2008, at 10:11 AM, Scott Price wrote:


Say if you allocate a temp object and add it to an NSMutableArray and then release it afterwords, does the NSMutableArray not make a deep copy and will lose the the variable?

_______________________________________________

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


References: 
 >NSMutableArray, NSMutableDictionary memory managment (From: Scott Price <email@hidden>)

  • Prev by Date: NSMutableArray, NSMutableDictionary memory managment
  • Next by Date: Re: creating new instance of coredata entity
  • Previous by thread: NSMutableArray, NSMutableDictionary memory managment
  • Next by thread: Re: NSMutableArray, NSMutableDictionary memory managment
  • Index(es):
    • Date
    • Thread