在 Java 中增加堆大小 [英] Increase heap size in Java

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

问题描述

我正在使用 8 GB RAM 的 Windows 2003 服务器(64 位).如何增加堆内存最大值?我正在使用 -Xmx1500m 标志将堆大小增加到 1500 Mb.我可以将堆内存增加到物理内存(6 GB 堆)的 75% 吗?

I am working on a Windows 2003 server (64-bit) with 8 GB RAM. How can I increase the heap memory maximum? I am using the -Xmx1500m flag to increase the heap size to 1500 Mb. Can I increase the heap memory to 75% of physical memory (6 GB Heap)?

推荐答案

您可以在 32 位系统上增加到 2GB.如果您使用的是 64 位系统,则可以更高.如果您选择错误,无需担心,如果您在 32 位系统上要求 5g,java 会抱怨无效值并退出.

You can increase to 2GB on a 32 bit system. If you're on a 64 bit system you can go higher. No need to worry if you've chosen incorrectly, if you ask for 5g on a 32 bit system java will complain about an invalid value and quit.

正如其他人发布的那样,使用 cmd-line 标志 - 例如

As others have posted, use the cmd-line flags - e.g.

java -Xmx6g myprogram

您可以通过键入 java -X 获得完整列表(或几乎完整的列表).

You can get a full list (or a nearly full list, anyway) by typing java -X.

这篇关于在 Java 中增加堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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