display used memory

hi all

Is there any way to display how much memory the cocos2dx app currently uses?

Regards
DimiR

Hi, and for what purpose do you need this for? Maybe you can just use external tools for monitoring memory usage like process explorer for windows or just simple task manager?

I was just wondering what the best way would be to load Sprites (which are quite big, most of them 1024 x 1024) for my sidescrolling game. I realised that when I call CCSprite::spriteWithFile it takes quite long so I cant do this during the game whitout getting freezes. I also noticed that it doesent’t take much time to init a CCSprite with an Image which has been initialized somewhere before as a CCSprite so it would be smart to init each texture I have at least one time before I start my game to avoid those freezes.

Now it would be interesting for me to know how much memory this takes and if it is efficient. I would also like to know what really needs much memory, so for example does only the first init of an image take much memory and when I create more sprites of the same image it doesn’t take that much? That would help me to decide if it is better to load one instance of each image before starting my game and then load everything whats left during the game, when my camera comes near that sprite, or I just load all sprites at once, before I start it (which wouldn’t really work for bigger levels…)

Or maybe there is even a better way?

Cocos2d-x uses a TextureCache mechanism (http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Texture_Cache) and that is why the same image loaded twice loads faster second time. You can also preload some textures to this cache in another thread with CCTextureCache::addImageAsync(). This way you could prevent your app from freezing but I dont know how many textures you use and how much memory you will need to load them all. If you use lots of big textures then you should also think about using some texture format that requieres less memory like PVR or RGBA4444 (they will also work faster than RGBA8888) if you are not using this currently. I hope this helped you a little.

http://www.learn-cocos2d.com/2010/07/coding-cocos/ - here’s the answer
I think the amount od used memory is much more worth displaying than SPF which in my opinion is absolutely useless