Java 选项 -Xmx 代表什么? [英] What does Java option -Xmx stand for?

查看:33
本文介绍了Java 选项 -Xmx 代表什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java -Xmx1024m 文件名

-Xmx 是什么意思?

推荐答案

参见此处:Java 工具文档,它说,

-Xmxn
指定内存分配池的最大大小(以字节为单位).该值必须是大于 2MB 的 1024 的倍数.附加字母 k 或 K 以指示千字节,或附加字母 m 或 M 以指示兆字节.默认值为 64MB.此值的上限在 Solaris 7 和 Solaris 8 SPARC 平台上约为 4000m,在 Solaris 2.6 和 x86 平台上约为 2000m,减去开销量.示例:

-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. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts. Examples:

           -Xmx83886080
           -Xmx81920k
           -Xmx80m

因此,简单来说,您将可用内存中的 Java 堆内存设置为最多 1024 MB,而不是更多.

So, in simple words, you are setting Java heap memory to a maximum of 1024 MB from the available memory, not more.

注意 -Xmx 和 1024m 之间没有 NO SPACE

使用大写或小写都没有关系.例如:-Xmx10G"和-Xmx10g"做的完全一样.

It does not matter if you use uppercase or lowercase. For example: "-Xmx10G" and "-Xmx10g" do the exact same thing.

这篇关于Java 选项 -Xmx 代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆