Memory leak from NSTimer? -
i'm developing app , , running well. not enough, though. when running "leaks" instrument, i'm seeing lot of leaks nstimer.
the nstimer started , stopped uiswitch. memory leak occurs each time switch flipped "off"
//playview.h @interface playview : uiviewcontroller { nstimer *autotimer; // other things } @property (nonatomic, retain) nstimer *autotimer; // etc... //playview.m #import "playview.h" @implementation playview @synthesize autotimer; - (ibaction) toggleenabledforswitch1: (id) sender { if (switch1.on) { self.autotimer = [nstimer scheduledtimerwithtimeinterval:0.5 target:self selector:@selector(updatecounter:) userinfo:nil repeats:yes]; } else { restart = 1; [self.autotimer invalidate]; self.autotimer = nil; [self.autotimer release]; } } - (void)updatecounter:(nstimer *)thetimer { // bunch of stuff } what causing this? i'm must simple , i'm missing it...
Comments
Post a Comment