You don't own any of those objects so you should not be releasing them.

See:
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/Articles/mmRules.html

-Noah


On Mar 18, 2010, at 11:43 PM, William Squires wrote:

> I have some code like below in a UITableView delegate (specifically, the one 
> that fires when you touch a tableview row):
> 
> ...
> NSDictionary *store = [self.stores objectAtIndex:indexPath.row];
> 
> // store name is like "NOBLE FINANCE" or "CUSTOMER CREDIT" or such; i.e. two 
> strings seperated by a space
> NSString *temp = [store objectForKey:kKeyStoreName];
> NSString *temp2 = [store objectForKey:kKeyCity];
> NSArray *storeComponents = [temp componentsSeperatedByDelimiter:@" "];
> NSString *temp3 = [NSString stringWithFormat:"%@ %@", [storeComponents 
> objectAtIndex:0], temp2];
> cell.label.text = temp3;
> // [temp3 release];
> // [storeComponents release];
> // [temp2 release];
> // [temp release];
> // [store release];
> ...
> 
>  If I uncomment any of the object releases above, the app crashes in the 
> simulator, and all the call-stack items are gray (non-user code). But if I 
> don't release them, they'll leak memory, won't they, since iPhone OS doesn't 
> have GC?
>  Note that I've verified that 'store' is actually an NSDictionary, and temp, 
> temp2, and temp3 are non-NIL at the time they're released.
> 
> _______________________________________________
> 
> 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/noah%40wireframesoftware.com
> 
> This email sent to [email protected]

_______________________________________________

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