【发布时间】:2013-09-10 09:30:48
【问题描述】:
我正在使用 Cocos2d 2.0 和 XCode 4.5.2,我确实想知道 如何检测在特定时间哪些 spritesheets/图像仍在内存中。
示例: 在场景中,我加载 images.pvr.ccz spritesheet,然后调用 replaceScene 加载 Scene2。在 Scene2 运行时,我想查看 images.pvr.ccz 是否仍在内存中作为 resident memory increases at each scene.
我应该使用一些仪器工具还是应该在纹理缓存相关的类中添加一些断点?
我确实将图像添加到 frameCache,如下所示:
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"images.plist"];
batchNode = [CCSpriteBatchNode batchNodeWithFile:@"images.pvr.ccz"];
[self addChild:batchNode];
其他详细信息 - 不需要
我有以下行为:每次替换场景时,内存都会增加“x”MB,这可能对应于 spritesheet 大小。
我在每个场景的 init 方法中添加了这些调用,但是内存仍然增加:
[CCAnimationCache purgeSharedAnimationCache];
[CCShaderCache purgeSharedShaderCache];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeUnusedSpriteFrames];
【问题讨论】:
标签: ios cocos2d-iphone