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