Heap not expanding on Genymotion emulator

点点圈 提交于 2019-12-05 06:26:04

Out of memory on a 31961100-byte allocation

Your bitmap is 32M. VM can't allocate 32M linear space to store bitmap. Heap is fragmented, so even if your heap has 32M free space it is not always possible to allocate such linear space. You can try free up as much memory as you can and call GC before decoding stream.

Try to decode your bitmap in more effective way. Or process image in parts. If you tell us why you need this image, we can tell you how to handle it.

ashoke

You have a 42MB heap , out of which 14MB is already used, 67% (28M) is free/available

    D/dalvikvm(1201): GC_BEFORE_OOM freed 2K, 67% free 14689K/43975K, paused ...
    E/dalvikvm-heap(1201): Out of memory on a 31961100-byte allocation.

You are trying to allocate ~31M (not 31K) , which is greater than 28M that is available, resulting in OOM.

For details on interpreting dalvikvm memory allocation log message take a look at debugging memory

There is lot of shared memory usage going on in android, to properly calculate per process memory usage refer this SO question

Android best practices on efficient bitmap memory management may be of help

One thing you might try to tweak is build.props file of the ROM.

On Genymotion emulator you can try executing the following via root shell:

cat /system/build.prop | grep dalvik 

and it would display the line with dalvik settings:

dalvik.vm.heapsize=256m
dalvik.vm.lockprof.threshold=500
dalvik.vm.stack-trace-file=/data/anr/traces.txt

And maxmemory is also being reported as 268435456 bytes on the emulator I experimented with.

So, you may try playing with this setting. Also, ensure that the memory allocated in VirtualBox's settings is compatible with these values.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!