5
votes

I am using Cocos2d 2.0 with ARC enabled. My game is a random generated game so I need to load/unload textures( spritesheet-batchnode) within a scene in the middle of the game. I am trying to removespriteframesfromfile and remove texture for key for a spritesheet that i wish to unload in the middle. When I use dumpcachedtextureInfo after unloading the sheet, that spritesheet texture doesnot show up in the logs of dumpcachedtextureinfo.

But when I use Instruments/activity monitor to profile my app, the real memory usage doesnot drop after unloading the texture and spritesheet.

Is there a way where dumpcachedtextureinfo will not show a texture that is still in memory? Also, My livebytes column in allocations shows 4 MB.

Also as i read at various places that allocations doesnot show texture memory.

So my allocations live bytes column says 4 MB, my total texture memory as shown with logs of dumpcchedtextureinfo is shown to be 84MB, but memory monitor stills shows real memory usage to be 84+Spritesheet size+ Live Bytes

I am not able to understand this difference?

I am not exiting the scene, so I am not sure if ARC is holding the memory or what?

1
Since you're already using Instruments, check if any of the big chunks of memory are still "living" and perhaps leaked. Other than that, perhaps you were looking at the total allocations column which will never decrease. - LearnCocos2D
I am concerned about the "Real Memory usage" metric under activity monitor. It doesnot decrease at all even after unloads. I cant understand why is that? - user1847220

1 Answers

4
votes

Some useful notes for you

enter image description here

enter image description here

  • To check memory leaks use: Instrument-> Leaks enter image description here