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

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

问题描述

如果我从Java命令行中省略-Xmxn选项,则使用默认值。根据 Java文档,默认值为在运行时基于系统配置选择。

If I omit the -Xmxn option from the Java command line a default value is 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 systems, 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 for -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天全站免登陆