Weird release problem on iPhone code
Weird release problem on iPhone code
- Subject: Weird release problem on iPhone code
- From: William Squires <email@hidden>
- Date: Thu, 18 Mar 2010 22:43:06 -0500
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@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