views:

403

answers:

1

I am detecin a memory leak particularily in the startAnimation method in the director object.

- (void) startAnimation
{
    if ( gettimeofday( &lastUpdate, NULL) != 0 ) {
     CCLOG(@"cocos2d: DisplayLinkDirector: Error on gettimeofday");
    }

    // approximate frame rate
    // assumes device refreshes at 60 fps
    int frameInterval = (int) floor(animationInterval * 60.0f);

    CCLOG(@"cocos2d: Frame interval: %d", frameInterval);

    displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(preMainLoop:)];
    [displayLink setFrameInterval:frameInterval];
    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}

It leaks at : [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(preMainLoop:)];

This only occurs in the device and not in the simulator. Not sure if anyone else is getting this?

A: 

You really should update to the latest build, there are quite some improvements with 0.99

eemceebee