There is an occasional EXC_BAD_ACCESS
error in my game using cocos2d-iphone
.
When it happens, Xcode does either of these:
- Show me the main.m file, with no stack backtrace etc.
- Show me a part in
cocos2d-iphone
's framework that handles touches related toCCMenu
. This of course suggests me that it is one of myCCMenu
instances what is causing the problem - however, I can't find which one because the backtrace seems to be, for some reason, limited to this area of the framework: basically, the backtrace won't show me my mistake because it doesn't cover my own code, onlycocos2d-iphone
's - and I'm fairly certain that it was my code what caused the problem.
Running out of luck, I decided to try out this NSZombie
thing. I went to the scheme menu and checked the zombie part.
From what I've read, what it does is NOT release anything ever. This way it can tell me what my object was which I was trying to access when I shouldn't have.
That sounds like a good plan. But it concerns me the fact that it doesn't ever release memory. My app is a game, and it loads massive amounts of textures and such, and in fact, it needs to release lots of textures every time you visit a new map. If my app won't release any of that, I believe it'd crash after a couple minutes of gameplay, as it is a very graphically heavy game.
Now, you could say that's not quite a big deal, because all I have to do is find the error, fix it, and disable Zombies and call it a day - a couple minutes should be enough...
... but, unfortunately, I have little idea about how to reproduce this error. In fact, I've spent hours trying to reproduce it. My only lead is that it might be related to a CCMenu
instance in my game, but pretty much every aspect of my game is a CCMenu
instance anyway.
Therefore, I would like to have Zombies enabled for long periods of time while I try to reproduce the error, which might not be possible because my app is likely going to crash for not releasing any memory for a good while. What do I do?