java JVM 内存默认值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1154614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 15:24:05  来源:igfitidea点击:

JVM Memory Defaults

javamemoryjvm

提问by Edward Q. Bridges

What is the default Xms and Xmx settings for the Sun JVM (v 1.4*) if those values are not specified at startup?

如果在启动时未指定这些值,那么 Sun JVM (v 1.4*) 的默认 Xms 和 Xmx 设置是什么?

回答by Jon Skeet

As documented:

正如记录的那样

  • Xmx: default 64M
  • Xms: default 2M
  • Xmx:默认64M
  • Xms:默认2M

That's for Linux, but I've checked and the values are the same for Windowsand Solaristoo. Don't rely on that being the case for other versions or options though. In particular, the choice of server or client VM depends on operating system, at least in later versions.

那是针对 Linux 的,但我已经检查过,WindowsSolaris的值也相同。但是,不要依赖其他版本或选项的情况。特别是,服务器或客户端 VM 的选择取决于操作系统,至少在以后的版本中是这样。

Another piece of documentation

另一份文件

回答by Laurence Gonsalves

From Sun's tooldocs:

来自Sun 的工具文档

-Xmsn Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. Examples:

           -Xms6291456
           -Xms6144k
           -Xms6m

-Xmxn Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples:

           -Xmx83886080
           -Xmx81920k
           -Xmx80m

-Xmsn 指定内存分配池的初始大小(以字节为单位)。该值必须是大于 1MB 的 1024 的倍数。附加字母 k 或 K 以指示千字节,或附加字母 m 或 M 以指示兆字节。默认值为 2MB。例子:

           -Xms6291456
           -Xms6144k
           -Xms6m

-Xmxn 指定内存分配池的最大大小(以字节为单位)。该值必须是大于 2MB 的 1024 的倍数。附加字母 k 或 K 以指示千字节,或附加字母 m 或 M 以指示兆字节。默认值为 64MB。例子:

           -Xmx83886080
           -Xmx81920k
           -Xmx80m

So 2MB and 64MB.

所以 2MB 和 64MB。

(The link above is for the 1.5 docs, but you can download the 1.4 docs, and they say the same thing.)

(上面的链接是针对 1.5 文档的,但您可以下载 1.4 文档,他们说的是同样的事情。)