cocos2d-x3.x 打印内存信息

auto ss= Director::getInstance()->getTextureCache()->getCachedTextureInfo();
    log("%s",ss.c_str());

"/Users/yannei/Library/Application Support/iPhone Simulator/7.1/Applications/1FB2A229-F755-4E39-887D-3057C3A692EC/baoweiluobo iOS.app/Pets/PetsTheme06-hd.png" rc=51 id=8 861 x 248 @ 32 bpp => 834 KB

"/Users/yannei/Library/Application Support/iPhone Simulator/7.1/Applications/1FB2A229-F755-4E39-887D-3057C3A692EC/baoweiluobo iOS.app/Pets/PetsTheme03-hd.png" rc=51 id=7 225 x 1003 @ 32 bpp => 881 KB

"/Users/yannei/Library/Application Support/iPhone Simulator/7.1/Applications/1FB2A229-F755-4E39-887D-3057C3A692EC/baoweiluobo iOS.app/Towers/tower9.pvr.ccz" rc=13 id=19 512 x 2048 @ 32 bpp => 4096 KB

"/Users/yannei/Library/Application Support/iPhone Simulator/7.1/Applications/1FB2A229-F755-4E39-887D-3057C3A692EC/baoweiluobo iOS.app/item/item1.pvr.ccz" rc=141 id=3 512 x 2048 @ 32 bpp => 4096 KB

TextureCache dumpDebugInfo: 33 textures, for 76980 KB (75.18 MB)


这些log显示了纹理的名字,引用数,id,大小以及像素的bit值,最重要的是它展示了内存使用情况。消耗了75.18 MB内存。


这里的“rc”代表纹理的“引用计数”。如果这个引用计数等于1或2的话,那么意味着,这个纹理当前可能不会需要使用了,此时,你可以放心地把它从纹理cache中移除出去。



你可能感兴趣的:(Class,cocos2d-x,cocostudio,cocos2d-x3.x)