Monday, June 8, 2009

Android Java Space OOM

The default Android java space heap maximum limitation is 16M. If you are running multimedia applications on android, such as jpg file decoding, video decoding, you may run OOM (Out Of Memory). If memory tuning can not help you on the OOM, you can go to the file: frameworks/base/core/jni/AndroidRuntime.cpp, line 607, change opt.optionString = "-Xmx16m" to opt.optionString = "-Xmx20m" for 20M heap size or even bigger.
The limitation is the upward limitation, it will not actually allocate 20M memory every time in every java application.
Take this solution as the last try, focus on your coding quality first.

4 comments:

Anonymous said...
This comment has been removed by the author.
Anonymous said...

Hi i want to edit http://www.netmite.com/android/mydroid/frameworks/base/core/jni/AndroidRuntime.cpp file in android
like change
opt.optionString = "-Xmx16m";
to
opt.optionString = "-Xmx20m";

i want to know if there is any way to do it.

any help will be appreciated
Thanks

onwebmedia said...

Personally, the post is in fact the most excellent on this impressive topic. I harmonize with your conclusions and will keenly look further to your future updates. I like your website. Thank you for great information. I will come back to your website again.
theft attorney Arlington TX

Arghya Chakraborty said...

Your post is such a refreshing someone to read through. This really is this kind of intriguing and insightful article to see other people. Keep up the great get the job done and more electrical power. Thanks!
herbalife