Re: Do I need to relase @"string" ??

2009-03-02 Thread Michael Ash
On Mon, Mar 2, 2009 at 7:50 PM, Joel Norvell wrote: > While it's important to keep Objective C's memory management model and rules > in mind, I've found the LLVM/Clang Static Analyzer to be the perfect tool for > double-checking my code.  It's a lot less neurotic than trying to remember > every

Re: Do I need to relase @"string" ??

2009-03-02 Thread Joel Norvell
While it's important to keep Objective C's memory management model and rules in mind, I've found the LLVM/Clang Static Analyzer to be the perfect tool for double-checking my code. It's a lot less neurotic than trying to remember everything, all the time, especially when you're starting out. Er

Re: Do I need to relase @"string" ??

2009-03-02 Thread Bryan Henry
Assuming that the setter is copying the value passed in (which it should be, considering setCurrentMiles: should accept a single NSString*), yes James, you should release currentMiles in your - (void)dealloc implementation for that class. The release won't affect the constant strings, but to

Re: Do I need to relase @"string" ??

2009-03-02 Thread Dave DeLong
My understanding was that he was referring to the setter in his AppDelegate class. Since the only thing (apparently) getting passed into the setter was an NSConstantString, it would seem that he wouldn't need to worry about releasing that property. (Assuming the setter was retaining it)

Re: Do I need to relase @"string" ??

2009-03-02 Thread Kyle Sluder
On Mon, Mar 2, 2009 at 3:58 PM, James Cicenia wrote: > DO I HAVE TO WORRY ABOUT RELEASING currentMiles somewhere? YOU MIGHT WANT TO WORRY about releasing your Shift key. ;-) Just follow the memory management guides. You didn't use +alloc, +new, or -copy to make the object, so you don't own it.

Re: Do I need to relase @"string" ??

2009-03-02 Thread Dave DeLong
For good practice, yes. In this isolated example, I don't believe so (because I'm pretty sure NSConstantString overrides -retainCount so that it can't ever be released). You may also want to consider simplifying your code to: ... NSString * miles[8] = {@"200", @"500", @"1000", @"150

Do I need to relase @"string" ??

2009-03-02 Thread James Cicenia
hello Here is my code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath { WhatsFreshAppDelegate *appDelegate = (WhatsFreshAppDelegate *) [[UIApplication sharedApplication] delegate]; if(indexPath.row == 0){ [appDelegate set