简体   繁体   English

为Android 4+设置Java堆大小

[英]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. 我想超过50MB,以达到Android 4.4+到Java 5.1的java的最大堆大小。 Seems there are no jvm command line parameters for the android only one setting you can put in the android manifest file. 似乎android没有jvm命令行参数,只有一个设置可以放入android清单文件中。 Also in another older reference I saw that there was a "fast" setting for the jvm and a "JIT" setting. 在另一个较早的参考资料中,我看到jvm的设置为“ fast”,而JIT设置为“ JIT”。 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. 因此,我不确定今天的Android使用什么来运行Java,以及我们为此使用的堆有哪些选项。

Thanks for the help. 谢谢您的帮助。 -Tony -托尼

I want to go beyond 50MB for max heap size for java for Android 4.4+ through 5.1. 我想超过50MB,以达到Android 4.4+到Java 5.1的java的最大堆大小。

That may or may not be possible, given the device. 给定设备,这可能或不可能。

Seems there are no jvm command line parameters for the android 似乎没有针对Android的jvm命令行参数

That is because Android does not use the JVM or a command line. 那是因为Android不使用JVM或命令行。

only one setting you can put in the android manifest file 您只能将一个设置放入android清单文件中

android:largeHeap="true" requests a "large" heap. android:largeHeap="true" 请求 “大”堆。 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. 例如,在系统RAM较低的设备(例如,具有512MB RAM的Android One设备)上,不仅常规堆限制可能低于50MB,而且大堆限制可能会低于50MB。

Also in another older reference I saw that there was a "fast" setting for the jvm and a "JIT" setting. 在另一个较早的参考资料中,我看到jvm的设置为“ fast”,而JIT设置为“ JIT”。

Citation, please, as Android does not use the JVM. 请引用,因为Android不使用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. 因此,我不确定今天的Android使用什么来运行Java,以及我们为此使用的堆有哪些选项。

You have android:largeHeap , and that's it, in terms of affecting the heap limit for Dalvik/ART processes (ie, conventional Android apps). 就影响Dalvik / ART进程(即传统的Android应用程序)的堆限制而言,您具有android:largeHeap就是这样。

Plus, as Matjaž Mav notes in the above comment , using a large heap has impacts on the user and on other developers. 另外,正如MatjažMav在上述评论中指出的那样,使用大堆会对用户和其他开发人员产生影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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