Out of Memory - dalvikvm-heap error

Hi friend,

Recently in our project SystemUI was crashing, saying that “Unfortunately, SystemUI has stopped”. I was supposed to fix it, so went through logcat and for found error as follow…

D/dalvikvm( 2120): GC_FOR_ALLOC freed 10K, 7% free 14024K/14983K, paused 10ms
I/dalvikvm-heap( 2120): Forcing collection of SoftReferences for 1587212-byte allocation
D/dalvikvm( 2120): GC_BEFORE_OOM freed 14K, 7% free 14009K/14983K, paused 0ms
E/dalvikvm-heap( 2120): Out of memory on a 1587212-byte allocation.
I/dalvikvm( 2120): "main" prio=5 tid=1 RUNNABLE
………………………………………………………………………………………..……………………………………………..
D/AndroidRuntime( 2120): Shutting down VM
W/dalvikvm( 2120): threadid=1: thread exiting with uncaught exception (group=0xb598b180)
E/AndroidRuntime( 2120): FATAL EXCEPTION: main
E/AndroidRuntime( 2120): java.lang.OutOfMemoryError
…………………………………………………………………………………………………………………………………………
E/AndroidRuntime( 2120):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1682):   Force finishing activity 

SOLUTION

The error is the default heap size was not enough, so we need to increase the heap size or decrease the data in the heap to overcome this problem. We planned to increase the heap size. So we mounted the system image and edited the build.prop file in it, and then the problem was solved.

The solution is to increase the dalvik heap size by entering the one line in the build.prop script inside the system folder.

Step 1: use a file explore and open the build.prop file inside the system folder.
Step 2: enter the dalvik.vm.heapsize=32m. (I needed 32 MB of heap, so I specified it as 32… you can modify it as per your need)
Step 3: Restart your android.
The problem solved :)

If you are working with android source code…if you are customizing the android… and you want to solve in the source code… follow the following steps…

Step 1: open the main.mk in the folder android/build/core.
Step 2: enter the line ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.heapsize=32m (I needed 32 MB of heap, so I specified it as 32… you can modify it as per your need) after the line ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt.
Step 3: save it and rebuilt it… 

The problem solved :)

From that time, I’m following the same, whenever I get out of memory problem ;)

0 comments:

Newer Post Older Post Home

NEWS AT A GLANCE

Loading...

Search This Blog

Loading...

About Me

My Photo
Hi everyone,myself Alagappan...electronic and communication engg. student... living in madurai... interested in everything... want to achieve something great in my lifetime...

Followers


Recent Comments