I'm participating in development of an Android application that uses quite heavy native library (~20Mb). Actual problem is that GC is working very frequently to resume some (but not too much) memory. Multiple times per second.
04-10 12:16:05.391 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 20ms, total 20ms
04-10 12:16:05.501 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6121K, 29% free 31708K/44359K, paused 23ms, total 23ms
04-10 12:16:05.601 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 23ms, total 23ms
04-10 12:16:05.702 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 25ms, total 25ms
04-10 12:16:05.802 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 28ms, total 28ms
04-10 12:16:05.902 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 28ms, total 28ms
04-10 12:16:06.002 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 26ms, total 26ms
04-10 12:16:06.122 18940-18951/com.some.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 6120K, 29% free 31708K/44359K, paused 41ms, total 41ms
In Android Device Monitor (Heap tab) tool I can see that >25 MB is allocated by 1-byte array (byte[], boolean[]), other parts consuming much lower heap. In Allocation Tracker I can see a lot of lines with 3133456 byte[] for dalvik.system.NativeStart.
It raises a question: does Android load all native library into memory or am I doing something wrong? I need some good explanation how Android deals with native libraries.
If there is no really effective way to reduce heap space taken by native library (removing dependency isn't an option, because not only Android uses it), then is there any other way to lower frequency of GC?
EDIT: Adding images to provide more information.
Heap space:
Memory allocation: