After Closing SKScene, Memory Remains High

别等时光非礼了梦想. 提交于 2019-12-04 02:44:32
ZeMoon

It has been noticed by a few people on SO that an SKScene gets deallocated when the containing SKView is removed from it's superview.

Have a look at these questions and their answers:

Deallocate SKScene after transition to another SKScene in SpriteKit

iOS 7 Sprite Kit freeing up memory

Also, try modifying the closeScene method like so:

- (void)closeScene {
    SKView *spriteView = (SKView*)self.view;
    [spriteView presentScene:nil];
    [self.navigationController popViewControllerAnimated:YES];
}

Put NSLog() to SKScene's dealloc method to be sure that it's deallocating.

Also, resources may be not released just after reference count of your scene reaches 0. Due to internal optimizations assets may stay in memory until receiving Memory warning signal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!