Confused about Memory Management with Collections
Confused about Memory Management with Collections
- Subject: Confused about Memory Management with Collections
- From: "Mazen M. Abdel-Rahman" <email@hidden>
- Date: Sat, 28 Nov 2009 14:19:46 -0700
Hi All,
I am trying to find out how memory is retained/released when using different Cocoa collection classes. Is there a good resource on this anyone can connect me to?
Here is some detailed questions about what I am trying to find out:
If I create a dictionary in the following manner (where myArray is an NSArray* and authorName is an NSString*)
NSDictionary * myDict = [NSDictionary dictionaryWithObjectsAndKeys:myArray, @"Titles", authorName, @"Name",nil];
Does this call automatically increase the retain count of myArray and authorName? So that I should call release on them if I don't need to have them anywhere else outside the dictionary? Or will calling release on them mess up the dictionary?
Also - once I am done with this dictionary - since I created it using a class method (and not alloc) - am I right in assuming that I should not call release on it? And if that is the case when does it get released?
Thanks for your help!
Mazen Abdel-Rahman
_______________________________________________
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