I’m a newbie with cocos2d-x, as well, and I also would like to know about releasing the memory (if needed).
The simple examples I’ve seen show how to load a sprite via CCCprite::spriteWithFile(“”), but as far as I can tell,
when you switch scenes via replaceScene(), none of the code explicitly calls a function to release
the memory. release() is called only on the destructor for the scene/layer which the sprite as added to.
So, if you’re switching among different scenes via replaceScene() (e.g., in a game where each level is a different
scene/layer) and the memory used to create each scene is not freed, then I can see that the device would
run out of memory really quick (unless I’m missing something obvious and that replaceScene() will call
the destructor for all objects in the scene/layer being replaced??)
I don’t know how others are doing it in their own game/app (I definitely would like to see some
examples), but it’s not clear/obvious how to do proper memory management without looking at what the
actual cocos2d-x source is doing (guess I’m used to explicitly calling malloc()/free() and knowing what objects
are created on the heap that need to be freed later).