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

查看:33
本文介绍了如何确定默认的最大 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

查找选项 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

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

I believe the resulting output is in bytes.

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

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