I have an NSTimer that fires off every second, and on that second I update a UILabel by setting the text property like so:
remainglbl.text = [NSString stringWithFormat:@"%i:%02i", var1, var2];
It works fine, but when I run it in xcode with Start With Performance Tool -> Leaks, it appears that the memory just keeps on climbing and climbing and climbing.
From my understanding, the string should be autoreleased (although I never see the memory decrease, or stop increasing).
Is this a memory leak? Is there a better way I can do this to keep my memory usage in check?
Thanks!
Update: code to create the timer is as follows:
timeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(changeTime:) userInfo:nil repeats:YES];
code to cleanup at timer finish is as follows:
[timeTimer invalidate];
[timeTimer release];
timeTimer = nil;
Anything wrong with this? I thought the memory might be freed once the timer finishes, but it doesn't.