Crashes when calling constructors.


The android version of my game crashes (IOS/Win32/Linux are fine) when calling constructors of subclasses of CCNode (never reaches my ctor code).
The crashes are 100 reproducible on my sgs2, acer iconia, and the simulator. I have had 100 success fixing these crashes by not explicitly defining a constructor, and putting the constructor code in an init method.

So far I’ve kinda brushed these problems under the covers, I was only prototyping some ideas. But now I have gotten to a point where I think I might actually have something, and these are starting to bug me.

I assumed I must have been corrupting some memory early on, but I have gone over all my code with a fine tooth comb, run static analyzers over it, cant see anything I am doing wrong (although I am sure I am). When I get a chance I’ll try to reproduce it in a simple test, just wanted to know if anyone else has experienced anything similar?


I am very interesting the tool you used.
Could you explain more about it?


Ahh sorry to dig up the old thread. Been away for a while.

Tried many tools on windows, in the end stuck with cpp-check, simple and gets the job done.

On Linux i make extensive use of valgrind/cachegrind to find memory errors/performance issues… That reminds me, I discovered a bug in CCImage for linux, the opened file is fclosed, but the file pointer gets used one more time afterwards. When I get home later, I can post a patch, but if you look its pretty obvious. Still present in the latest source when I updated a few days back.

But as for my initial problem, when I moved to ndk-6b they disappeared.

Anyway, just want to say thanks for the awesome port. The game I am working on is coming along very nicely :slight_smile:


You said CCImage has a bug on linux, and you use ndk.
So, what’s the file you said, CCImage.cpp, CCImage_linux.cpp or CCImage_android.cpp?


Posted response there:

As its a linux bug.