Reputation: 2207
is it enough if I set the visibility to NO on my CCNode/CCSprite? Is it still in the memory?
What's the best way to remove it from memory and than put it again to it (fast)?
What about b2Body's? How to do that on them?
I want to do this because I splitted up my level and I just want to put the objects into memory which are visible....
Upvotes: 0
Views: 415
Reputation: 7625
Setting a node/sprite to invisible will definitely not free it from memory. If you want to remove it from memory completely and add it in again quickly I suspect a memory pool is the best way to do that.
I'm not sure I understand why you want to have only objects that are visible in memory and then be able to quickly add them into memory again quickly? It's likely I just don't follow what you are trying to accomplish. You may be trying to optimize your memory usage to prematurely. Certainly you should stop all memory leaks but have you done any profiling as to how much memory your project is using?
Upvotes: 2