问题描述
有没有办法以编程方式设置最大 java 堆大小而不是作为 vm 参数?
Is there a way to set the max java heap size programmatically instead of as a vm argument?
类似:
System.getProperties().put("<heap variable>", "1000m");
推荐答案
不适用于任何 Hotspot JVM.JVM 堆参数只能在命令行中指定,然后在 JVM 的生命周期内固定.
Not with any Hotspot JVM. The JVM heap parameters can only be specified on the command line, and are then fixed for the lifetime of the JVM.
使用 Hotspot Java 实现,更改"应用程序的堆大小的唯一方法是在具有不同命令行参数的新 JVM 中重新启动它.
With Hotspot Java implementations, the only way to "change" the heap size of an application is to relaunch it in a new JVM with different command line parameters.
(我隐约记得其他一些供应商的 JVM确实允许在运行的 JVM 中更改一些堆参数.也许有人可以澄清一下.)
(I vaguely recall that JVMs from some other vendors do allow some heap parameters to be changed in a running JVM. Perhaps someone can clarify.)
这篇关于以编程方式设置最大 Java 堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)