问题描述
请解释Xms 和Xmx 参数在JVM 中的使用.它们的默认值是什么?
Please explain the use of the Xms and Xmx parameters in JVMs. What are the default values for them?
推荐答案
标志 Xmx 指定 Java 虚拟机 (JVM) 的最大内存分配池,而 Xms 指定初始内存分配池.
The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool.
这意味着您的 JVM 将以 Xms 内存量启动,并且能够使用最大 Xmx 内存量.例如,像下面这样启动 JVM 将使用 256 MB 内存启动它,并允许进程使用最多 2048 MB 内存:
This means that your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory. For example, starting a JVM like below will start it with 256MB of memory and will allow the process to use up to 2048MB of memory:
java -Xms256m -Xmx2048m
内存标志也可以指定为不同的大小,如千字节、兆字节等.
The memory flag can also be specified in different sizes, such as kilobytes, megabytes, and so on.
-Xmx1024k
-Xmx512m
-Xmx8g
Xms 标志没有默认值,Xmx 通常有 256 MB 的默认值.这些标志的常见用途是当您遇到 java.lang.OutOfMemoryError.
The Xms flag has no default value, and Xmx typically has a default value of 256MB. A common use for these flags is when you encounter a java.lang.OutOfMemoryError.
使用这些设置时,请记住,这些设置是针对 JVM 的 堆 的,并且 JVM 可以并且将使用更多的内存,而不仅仅是分配给堆的大小.来自 Oracle 的文档:
When using these settings, keep in mind that these settings are for the JVM's heap, and that the JVM can and will use more memory than just the size allocated to the heap. From Oracle's documentation:
请注意,JVM 使用的内存不仅仅是堆.例如,Java 方法、线程堆栈和本机句柄被分配在与堆分开的内存中,以及 JVM 内部数据结构中.
Note that the JVM uses more memory than just the heap. For example Java methods, thread stacks and native handles are allocated in memory separate from the heap, as well as JVM internal data structures.
这篇关于启动JVM时-Xms和-Xmx参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


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