PDA

View Full Version : clock tik tik leak leak - GSEventRunModal




IDMah
Aug 15, 2012, 04:45 PM
Hi all..

Getting closer to a release.
In Zombies I have a gazillion GSEventRunModal allocs.
Figuring it has to do with My Animation images.

Basically a clock. which ticks second animating to a frame and then pausing.

Do I need to remove the animation after I animate it??

here is the Animation code:

-(void)animateTime:(NSArray *)framesArray
timeView:(UIImageView *)timeViewer
position_X:(CGFloat)animPosX
position_Y:(CGFloat)animPosY
totalFrames:(NSInteger)totalFrames
{

//UIImageView *animatedOSeconders = [[UIImageView alloc] initWithFrame:CGRectMake(18.5,315.5, 55.11, 55.11)];
/*
animatedOSeconders = [[UIImageView alloc]
initWithFrame:CGRectMake(animPosX,animPosY, 55.11, 55.11)];
*/

timeViewer.alpha = 1.00;

//[self.window addSubview:heldAnimatedOSeconders];
//[self.window bringSubviewToFront:timeViewer];
[self.window makeKeyAndVisible];

//animatedOSeconders.animationImages = [NSMutableArray arrayWithArray:oSecondesFrames];
timeViewer.animationImages = [NSMutableArray arrayWithArray:framesArray];

// One cycle through all the images takes 1 seconds

timeViewer.animationDuration = (totalFrames/12);

// Repeat forever
timeViewer.animationRepeatCount = 1;


// Add subview and make window visible

//[self.window addSubview:animatedOSeconders];
//[self.window insertSubview:timeViewer aboveSubview:heldAnimatedOSeconders];
[self.window makeKeyAndVisible];
//[animatedOSeconders release];
/*
if (clockStart) {
timeViewer.startAnimating;
}
*/
if (!clockStart) {
//NSLog(@"animation begun");
}
//!(clockStart);
[timeViewer startAnimating];

[self performSelector:@selector(doNothing) withObject:nil afterDelay:(totalFrames/12)];
//[timeViewer removeFromSuperview];


}


no crashes but Zombies say I keep allocating memory.. and I'd like to plug as many leaks as I can before submission to itunes..

thanks
Ian

ps. [timeViewer removeFromSuperview]; just crashes the app. think because it removes it before complete.. ?si? where is the correct place to do this?? in AnimationDidEnd?? stop???



ArtOfWarfare
Aug 16, 2012, 10:22 PM
If you use ARC, will it not just handle the memory for you?

IDMah
Aug 18, 2012, 01:04 PM
Thanks trying to avoid arc right now.
Part(s) as a lesson in writing good code and learning to debug better.

Well I guess I'll keep slugging. but confused which tool is best for
this sort of thing.. Zombies yields a lot of Data but so much that
it constantly crashes. Leaks less but I don't get what it's telling me.

any good (ie for a dummy like me) tutorials on memory leak finding???

thanks
Ian