Random crashes on Android, "INVALID HEAP ADDRESS IN dlfree" - "Fatal signal 11 (SIGSEGV) at 0xdeadbaad"

Today, I went to go test my app on Android (I normally develop on Win32), and I noticed that at seemingly random times, the app would crash, saying

I read somewhere that this could be memory corruption, but I was unable to find the point in my code in which that happens and what causes it.

ndk-stack wasn’t helpful either, saying merely:

Can anyone help? This is an an 4.0.3,ICS US-Verizon Samsung Galaxy S III, (SCH-I535). However, this also happens on the emulator.

  1. connect your deivce to computer
  2. see if logcat is showing in ecllipse.
  3. open terminal (i hvae tried in ubuntu and MAC , in case window i am not sure)
  4. according to ndk-stack manual , use followng command “adb logcat | $NDK_ROOT/ndk-stack -sym $GAME_ROOT/proj.android/obj/local/armeabi/” , type without “” …. leave this terminal
  5. after issuing this command reproduce or wait for the crash , go back to terminal where you have issued command…… you will probably see the actual error …

nJOY:)

Nope, I get

Is there a way to get those symbol files?

if in $GAME_ROOT/proj.android/obj/local/armeabi/ there are sym files then … there might be problem with path …. i cannot understnd cygwin path system …… i never used it …… but one thing i will mention, in command "sym " will tell logcat that symbolic files are in path given aftersym ….

I changed the “~~sym /cygdrive/c/…" to "~~sym C:/”… and it worked! However, I discovered that I am actually facing multiple different crashes (perhaps related?)

The first one:

And the second:

Which is not very helpful IMO.

Third:

Which happens at around the same time as the second.

Fourth:

The only ones that seem maybe useful to me are the first and third one. I am wondering why I am getting so many different crashes.

I have also just gotten:

Hi,i had see the same crash,and do u know how to fix it now?

I had the same problem yesterday and the reason was

I had a custom CCMenuItem Class in which I was using a boolean variable of same name as a method name already was defined in CCMenuItem which was causing memory leak.