HEAP MEMORY CORRUPTION IN dlmalloc or dlfree and SIGSEGV errors in Android ICS 4.0
Asked Answered
R

2

11

Since I couldn't find anyone reporting this behaviour before I thought about posting the problem and my solution here so it could help others who are having this problem. Our app did work great on devices prior to ICS. We tested our app on the Galaxy Nexus and the ICS emulator and saw weird process crashes of the following kind:

HEAP MEMORY CORRUPTION IN dlmalloc

HEAP MEMORY CORRUPTION IN dlfree

signal 11 (SIGSEGV), fault addr deadbaad

The problem is that the crashes occured in the native space so there wasn't any self written code which affected it directly. Since we handle a lot of images in lists and the system allocates bitmaps for those the only thing which came to mind was some bad bitmap handling. We followed all best practices out in the web and we even helped the GC to collect unneeded resources by calling bitmap.recycle(). Anyway, for some unknown reason the application crashed constantly on Android ICS 4.0.

Rheinland answered 8/12, 2011 at 12:23 Comment(0)
R
22

After some investigation I removed the call to recycle() and everything works out great now. It seems that the garbage collector in ICS already clears the bitmaps correctly. Our call to recycle() caused the system to attempt to deallocate the memory in the native space but the memory was already cleared by the system. Somehow bad memory access occured and the system crashed. So if you are programming for Android ICS 4.0 and you are experiencing those problems, you might want to try without recycling your bitmaps explicitly.

Rheinland answered 8/12, 2011 at 12:23 Comment(3)
What led you to try removing the call to recycle()? I'm curious as I'm experiencing a similar error but I don't have any calls to Bitmap.recycle().Gonsalez
I had the same problem and removing the call to recycle() did indeed the job.Copland
I had the same problem, and removing Bitmap.recycle() fix it. Without a helpful log, it was really difficult to find what causing the problem.Thank you @MarioBDissentient
P
0

If you compile your app against ICS onward, there is no need to explicitly call recycle as this will cause signal 11 (SIGSEGV) error.

Peculation answered 3/3, 2012 at 11:31 Comment(2)
Well, that's basically what I said above o.ORheinland
If you are writing a response that copies some one else's response, please try to add some meat to it, like a link to documentation that proves the affirmation.Unknown

© 2022 - 2024 — McMap. All rights reserved.