• 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: releasing NSArrays, NSDictionaries, etc ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: releasing NSArrays, NSDictionaries, etc ??


  • Subject: Re: releasing NSArrays, NSDictionaries, etc ??
  • From: Peter Ammon <email@hidden>
  • Date: Tue, 25 Sep 2001 19:23:52 -0400

On Tuesday, September 25, 2001, at 10:09 AM, Robert Miller wrote:

Hello,

Here's a very basic question, I think. It states in the Cocoa
documentation that when an NS 'Mutable' array or dictionary is released,
all of the objects it (they) contain are sent release messages as well.
Does the same hold true for non-mutable forms of NSArray ,
NSDictionary,etc.? It mentions that a retain message is sent when added
but, does not actually state that a release message is sent when object
itself (the NSArray or NSDictionary) is released (unless I missed it
somewhere which is entirely possible)

The release messages are sent when the collection (a collection is an NSDictionary, NSSet, or NSArray, or any of their mutable subclasses) is actually deallocated, NOT when it is merely released. This is true for the immutable as well as the mutable collections.

It appears that in Mac OS X 10.0.x, the objects are actually sent autorelease messages, whereas in 10.1 they are sent release messages (can I talk about this now?). I suppose this was done for performance. This caused a bit of my code to break and it took some hunting to figure it out, so maybe this will spare someone else the trouble.

-Peter


References: 
 >releasing NSArrays, NSDictionaries, etc ?? (From: Robert Miller <email@hidden>)

  • Prev by Date: SELs in arrays
  • Next by Date: Re: Text field and copy/paste...
  • Previous by thread: Re: releasing NSArrays, NSDictionaries, etc ??
  • Next by thread: Scroll View
  • Index(es):
    • Date
    • Thread