clock tik tik leak leak - GSEventRunModal

Discussion in 'iPhone/iPad Programming' started by IDMah, Aug 15, 2012.

  1. macrumors regular

    Joined:
    May 13, 2011
    #1
    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:
    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.
    Code:
    [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???
     
  2. macrumors 603

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    If you use ARC, will it not just handle the memory for you?
     
  3. thread starter macrumors regular

    Joined:
    May 13, 2011
    #3
    Leaks, zombies, Allocation which do I use.

    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
     

Share This Page