动画内存的释放

以知易的AnimationHelper方法生成Animation,如下:

CCAnimation *AnimationHelper::animationWithFrame(const char* frame, int frameCount, float delay) {
                CCArray *frames = new CCArray();
                for (int i = 1; i <= frameCount; i++) {
                                char *file = new char;
                                sprintf(file, "%s%d.png", frame, i);
                                CCSpriteFrameCache *frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
                                CCSpriteFrame *frame = frameCache->spriteFrameByName(file);
                                frames->addObject(frame);
                }
                return CCAnimation::createWithSpriteFrames(frames, delay);
}

用zwoptex打包贴图集,以CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("***.plist");的方法加载进内存。

当动画完成播放后,调用CCSpriteFrameCache::sharedSpriteFrameCache()->purgeSharedSpriteFrameCache();或removeSpriteFrameByName("***.plist");
还有CCTextureCache::sharedTextureCache()->purgeSharedTextureCache();
这两个方法清理内存,但是调用之后,在内存监测上看到的内存占用并没有减小,求解…

如果不让精灵runAction的话,是可以removeUnusedTexture的,但是,一旦精灵有调用到frame并且在屏幕上有渲染过的话,就清不掉内存了,即使在场景中把精灵remove掉…

— Begin quote from ____

rulerzhang 发表于 2012-10-12 17:25 url

如果不让精灵runAction的话,是可以removeUnusedTexture的,但是,一旦精灵有调用到frame并且在屏幕上有渲 …

— End quote

那这个要咋处理啊。。。