如何确定默认的最大Java堆大小? [英] How is the default max Java heap size determined?

查看:396
本文介绍了如何确定默认的最大Java堆大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从Java命令行中省略了-Xmxn选项,那么将使用默认值.根据 Java文档

If I omit the -Xmxn option from the Java command line then a default value will be used. According to Java documentation

在运行时根据系统配置选择默认值"

"the default value is chosen at runtime based on system configuration"

哪些系统配置设置会影响默认值?

What system configuration settings influence the default value?

推荐答案

在Windows上,您可以使用以下命令来查找运行应用程序的系统上的默认设置.

On Windows, you can use the following command to find out the defaults on the system where your applications runs.

java -XX:+ PrintFlagsFinal -version | findstr HeapSize

java -XX:+PrintFlagsFinal -version | findstr HeapSize

查找选项MaxHeapSize(对于-Xmx)和InitialHeapSize对于-Xms.

Look for the options MaxHeapSize (for -Xmx) and InitialHeapSize for -Xms.

在Unix/Linux系统上,您可以这样做

On a Unix/Linux system, you can do

java -XX:+ PrintFlagsFinal -version | grep HeapSize

java -XX:+PrintFlagsFinal -version | grep HeapSize

我相信结果输出以字节为单位.

I believe the resulting output is in bytes.

这篇关于如何确定默认的最大Java堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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