hi everybody:
when I replace scene,I use CCTextureCache::sharedTextureCache()->removeUnusedTextures(); CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames();
to release memory.It works but not very well.I find that there are still about 20 - 30M memory I can’t release.What should I do to release memory.
Thank u a lot.
CCTextureCache::sharedTextureCache()->removeUnusedTextures();
CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames();
The above code only remove the objects which retainCount() is equal to 1.
Maybe the retainCount is larger than 1. You can try to use
CCSpriteFrameCache::sharedSpriteFrameCache()->removeSpriteFramesFromFile
CCTextureCache::sharedTextureCache()->removeTexture
to remove the textures and spriteframes.
I have found that removeUnusedSpriteFrames must be called before removeUnusedTextures. Otherwise the textures in the spriteframes will not be removed.
CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames();
CCTextureCache::sharedTextureCache()->removeUnusedTextures();
hi, when is the best moment to call those methods? onExit? scene destructor?
Thkns