【发布时间】:2009-11-26 18:30:51
【问题描述】:
我检测到内存泄漏,特别是在 director 对象的 startAnimation 方法中。
- (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];
}
它泄漏在:[NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(preMainLoop:)];
这只发生在设备中而不是模拟器中。 不确定其他人是否得到这个?
【问题讨论】:
-
你使用的是新的 0.9.0 alpha 版本的 cocos2d 吗?我在 0.8.2 中找不到这个
-
我使用的是 0.8.2,这仅在我将其编译到实际设备中而不是在模拟器中时发生。
标签: objective-c memory-leaks cocos2d-iphone