1

尝试使用 1G 内存运行 java 时出现以下错误。

C:\>java -verbose -Xmx1G

当我运行它时,我收到以下消息:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

最大内存设置为 768M 时运行良好。我正在使用 Java 7(构建 1.7.0_15-b03)。

这是我的系统信息

Total Physical Memory:     3,510 MB
Available Physical Memory: 2,393 MB
Virtual Memory: Max Size:  2,048 MB
Virtual Memory: Available: 1,965 MB
Virtual Memory: In Use:    83 MB
OS: Windows XP.
4

1 回答 1

1

堆不仅取决于可用的 RAM 或物理内存。32 位 JVM 的最大理论堆限制为 4G。由于各种额外的限制,例如可用交换、内核地址空间使用、内存碎片和 VM 开销,实际上限制可以低得多。

于 2013-05-17T09:54:41.880 回答