简体   繁体   中英

Setting java heap size for Android 4+

I have googled about this and seems either the answers are very old and vague or new and unanswered. I want to go beyond 50MB for max heap size for java for Android 4.4+ through 5.1. Seems there are no jvm command line parameters for the android only one setting you can put in the android manifest file. Also in another older reference I saw that there was a "fast" setting for the jvm and a "JIT" setting. So I am not sure what is being used for the Android of today to run java and what options we have for the heap for that.

Thanks for the help. -Tony

I want to go beyond 50MB for max heap size for java for Android 4.4+ through 5.1.

That may or may not be possible, given the device.

Seems there are no jvm command line parameters for the android

That is because Android does not use the JVM or a command line.

only one setting you can put in the android manifest file

android:largeHeap="true" requests a "large" heap. Whether you get a bigger heap limit, and what that limit is, is up to the device manufacturer, not you. For example, on devices with low system RAM (eg, Android One devices with 512MB of RAM), not only may your regular heap limit be below 50MB, but your large heap limit may be below 50MB.

Also in another older reference I saw that there was a "fast" setting for the jvm and a "JIT" setting.

Citation, please, as Android does not use the JVM.

So I am not sure what is being used for the Android of today to run java and what options we have for the heap for that.

You have android:largeHeap , and that's it, in terms of affecting the heap limit for Dalvik/ART processes (ie, conventional Android apps).

Plus, as Matjaž Mav notes in the above comment , using a large heap has impacts on the user and on other developers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM