I'd also hasten to remind that collections retain their objects, but if those objects are mutable, like NSMutableString, than anybody that holds a ref to them can change them at any time, so in some cases you do want to make deep or immutable copies of these objects, depending on context. I've been bitten by this before.

On Sep 11, 2008, at 10:32 AM, infinite labs wrote:

On Thu, Sep 11, 2008 at 7:18 PM, Jamie Hardt <[EMAIL PROTECTED]> wrote:

"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."

Word of warning: NSPointerArray and NSHashTable (the 10.5 class)
aren't available on the iPhone, but CFDictionary with proper callbacks
set can replace them.

- ∞

Jamie Hardt
The Sound Department
http://www.soundepartment.com/
http://www.imdb.com/name/nm0362504/

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to