cocostudio内存释放

it2025-07-06  7

     在使用cocostudio时,在释放内存时能够这样做:

     在onExit()方法里加入例如以下:

void LoadLayer::onExit() { // 释放本对象自己 removeFromParentAndCleanup(true); // 清理GUI管理类(这个不要放到最后清理) GUIReader::shareReader()->purge(); // 清理场景管理(全部读取的场景都会被清理掉) SceneReader::sharedSceneReader()->purge(); // 清理动作(这里指Action动作,不是动作编辑器的动作。

) ActionManager::shareManager()->purge(); // 清理数据管理 DictionaryHelper::shareHelper()->purgeDictionaryHelper(); // 释放掉不用的纹理 CCTextureCache::sharedTextureCache()->removeAllTextures(); CCTextureCache::sharedTextureCache()->removeUnusedTextures(); CCLayer::onExit(); }

转载于:https://www.cnblogs.com/bhlsheji/p/5135495.html

相关资源:数据结构—成绩单生成器
最新回复(0)