开发者

Is anyone have memory leaks using cocos2d?

I am detecin a 开发者_JS百科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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜