My application does not use NDK. I am testing it on the GenyMotion Nexus 7 emulator and the problem is quite hard to reproduce and I still haven't figured out a correct way to reproduce it. Sometimes the application works fine for a long time and sometimes it just crashes and automatically restarts after about 30 seconds of using.
EDIT: I am not 100% but it only happens on genymotion emulator, but not regular android emulator (I will continue testing).
The problem started happenning when I added support for a large screen when in landscape mode (started displaying two fragments at once in landscape and only 1 in portrait (with width smaller than 720)).
One of the fragments lazy loads images (from memory, disk or internet).
I am quite new to this dynamic adding and removing of fragments so I'm sure there could be something there.
Anyway please help me decode this dump and figure out what's causing the crash (I will try to ommit stuff I think isn't important):
12-17 16:52:18.344 1255-1255/? A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x97858094 (code=2), thread 1255 (hiexpressgradle)
12-17 16:52:18.448 121-121/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-17 16:52:18.448 121-121/? I/DEBUG﹕ Build fingerprint: 'generic/vbox86tp/vbox86tp:4.3/JLS36G/eng.buildbot.20131127.101043:userdebug/test-keys'
12-17 16:52:18.448 121-121/? I/DEBUG﹕ Revision: '0'
12-17 16:52:18.448 121-121/? I/DEBUG﹕ pid: 1255, tid: 1255, name: hiexpressgradle >>> XXX <<<
12-17 16:52:18.448 121-121/? I/DEBUG﹕ signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 97858094
12-17 16:52:18.608 121-121/? I/DEBUG﹕ eax 00000000 ebx b754a6fc ecx 0000000e edx 978580a2
12-17 16:52:18.608 121-121/? I/DEBUG﹕ esi 0000000c edi 00000001
12-17 16:52:18.608 121-121/? I/DEBUG﹕ xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
12-17 16:52:18.608 121-121/? I/DEBUG﹕ eip b754a6fc ebp b94985e8 esp bfe29398 flags 00210292
12-17 16:52:18.608 121-121/? E/Corkscrew﹕ unrecognized DW_CFA_* instruction: 0x10
12-17 16:52:18.608 121-121/? I/DEBUG﹕ backtrace:
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #00 pc 0002f6fc /system/lib/libc.so (memset+140)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #01 pc 00015c6f /system/lib/libhwui.so (android::uirenderer::FontRenderer::cacheBitmap(SkGlyph const&, android::uirenderer::CachedGlyphInfo*, unsigned int*, unsigned int*, bool)+511)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #02 pc 00011aea /system/lib/libhwui.so (android::uirenderer::Font::precache(SkPaint*, char const*, int)+922)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #03 pc 0001414e /system/lib/libhwui.so (android::uirenderer::FontRenderer::precache(SkPaint*, char const*, int, android::uirenderer::Matrix4 const&)+78)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #04 pc 00024aa6 /system/lib/libhwui.so (android::uirenderer::DrawTextOp::onDefer(android::uirenderer::OpenGLRenderer&, int*, void**)+486)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ stack:
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29358 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2935c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29360 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29364 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29368 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2936c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29370 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29374 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29378 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2937c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29380 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29384 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29388 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2938c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29390 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29394 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #00 bfe29398 b5ba5aac /system/lib/libhwui.so
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2939c b5b3ec70 /system/lib/libhwui.so (android::uirenderer::FontRenderer::cacheBitmap(SkGlyph const&, android::uirenderer::CachedGlyphInfo*, unsigned int*, unsigned int*, bool)+512)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #01 bfe293a0 97858094
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293a4 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293a8 0000000e
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293ac bfe2940c [stack]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293b0 b9726ae4 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293b4 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293b8 b934c340 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293bc b6bff210 /system/lib/libskia.so (SkGlyphCache::findImage(SkGlyph const&)+144)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293c0 b972f550 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293c4 b934b588 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293c8 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293cc 00000032
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293d0 bfe29410 [stack]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293d4 bfe2940c [stack]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293d8 97858008
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe293dc b6eb8d48 /system/lib/libskia.so
12-17 16:52:18.608 121-121/? I/DEBUG﹕ ........ ........
12-17 16:52:18.608 121-121/? I/DEBUG﹕ #02 bfe29430 b94985e8 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29434 b9726ae4 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29438 b966b9c8 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2943c bfe29470 [stack]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29440 bfe29474 [stack]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29444 00000001
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29448 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2944c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29450 3f800000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29454 00000010
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29458 b966b9c8 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2945c b9670dc6 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29460 b94907a4 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29464 b9670e28 [heap]
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe29468 3f800026
12-17 16:52:18.608 121-121/? I/DEBUG﹕ bfe2946c 00000000
12-17 16:52:18.608 121-121/? I/DEBUG﹕ ........ ........
12-17 16:52:18.608 121-121/? I/DEBUG﹕ memory map around fault addr 97858094:
12-17 16:52:18.608 121-121/? I/DEBUG﹕ 977fa000-97858000 r-x /dev/ashmem/dalvik-jit-code-cache (deleted)
12-17 16:52:18.608 121-121/? I/DEBUG﹕ 97858000-97859000 r-x
12-17 16:52:18.608 121-121/? I/DEBUG﹕ 97859000-978d9000 rw-
Thanks for your input @Simon, after some testing I started to get an error on the android emulator aswell. But on the android emulator it was a good old OutOfMemory exception. So it turns out that my drawable manager (on one of the fragments) had a huge memory leak where it would bloat a HashMap with drawables. It only became an issue when I implemented the two pane layout, since the DrawableManager would always stay in memory (because the category selection fragment that holds the manager never gets recreated) even when I switched categories.
EDIT: Even though I've solved my memory leak, my genymotion emulator still crashes with the same SIGSEGV, So I guess this question is still open.
Tested Solution its work:
mention these permission in manifiest:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
android:allowBackup="true"
android:vmSafeMode="true"
android:allowClearUserData="true"
android:hardwareAccelerated="true" >