Hi,
I am porting my tower defense game from iOS to android.
The android version will crash as soon as I entering the game scene.
I think it is cause by the heap problem. The heap size is about 7m, and it will be full at the very begin when launch the game.
Does anyone know how to fix it?
1.png (62.4 KB)
I don’t think it is a heap problem.
7m is not big enough to cause crash.
You should translate crash stack to see what causes the problem.
Hi
Thanks for your reply.
After couple days of debugging, I found the crash is not caused by the heap size.
It often crash in engine interfaces (I noticed this by adding plenty of CCLog() functions).
For example, I have a class inherited from CCSprite, when I invoke this~~>addChild, it will crash sometimes ; then I modified it to addChild , there will be less crashes.
I checked google and found a explanation for this is RTTI, but I check my project, the mk file in project/android/jni/Application.mk is already set to like this:
APP_STL := gnustl_static
APP_CPPFLAGS +=~~frtti
APP_MODULES := cocos2d cocosdenshion game_logic helloworld
Do you have any idea what is happening or what have I did is not correct?
And by the way, how could I translate the crash stack?
Please refer NDK-STACK.html, it is under NDK_ROOT/docs.
The ndk version should be r6 or later.
And how about the upper question? It is more fatal.
RE: Android Heap Problem - Added by Nicolas Dai about 2 hours ago
Hi
Thanks for your reply.
After couple days of debugging, I found the crash is not caused by the heap size.
It often crash in engine interfaces (I noticed this by adding plenty of CCLog() functions).
For example, I have a class inherited from CCSprite, when I invoke this~~>addChild, it will crash sometimes ; then I modified it to addChild , there will be less crashes.
I checked google and found a explanation for this is RTTI, but I check my project, the mk file in project/android/jni/Application.mk is already set to like this:
APP_STL := gnustl_static
APP_CPPFLAGS +=~~frtti
APP_MODULES := cocos2d cocosdenshion game_logic helloworld
Do you have any idea what is happening or what have I did is not correct?