简体   繁体   English

java-在32位Windows中将文件用于大于1Gb的Java堆空间

[英]java- use a file for java heap space bigger than 1Gb in a 32bit windows

Using: -Xms1000M -Xmx4000M -mx1000m I still get a java.lang.OutOfMemoryError: Java heap space 使用:-Xms1000M -Xmx4000M -mx1000m我仍然得到java.lang.OutOfMemoryError:Java堆空间

I am using the jai-imageio library to read a 100Mb JPEG2000 file, and it may need more than 1Gb heap space once decompressed by the imageio lib. 我正在使用jai-imageio库读取100Mb JPEG2000文件,并且一旦由imageio lib解压缩后,它可能需要超过1Gb的堆空间。 I am using a 32bit windows JVM, so I can't create more than 1G heap space. 我正在使用32位Windows JVM,因此我不能创建超过1G的堆空间。

See this post: java- OutOfMemoryError with -Xms1000M -Xmx4000M -mx1000m 看到这个帖子: java- OutOfMemoryError with -Xms1000M -Xmx4000M -mx1000m

So, is there a way to tell JVM to use a file for the heap memory, instead of ram memory (to be able to have a heap space bigger than 1Gb, even in a 32bit windows)? 因此,是否有一种方法可以告诉JVM将文件用作堆内存,而不是ram内存(即使在32位窗口中,堆空间也可以大于1Gb)?

This is a limitation of the operating system (and the number of bits you have in your addresses). 这是操作系统的限制(以及地址中位数的限制)。 You need to use a 64-bit OS and a 64-bit JVM. 您需要使用64位OS和64位JVM。

When you add to the swap space you are allowing the JVM to use this file as swap space. 当添加到交换空间时,您将允许JVM使用此文件作为交换空间。 Note: do so can decrease your performance by 10x or more. 注意:这样做可能会使您的性能降低10倍或更多。

You should be able to get a heap of between 1.2 GB and 1.5 GB on 32-bit windows. 您应该能够在32位窗口上获得1.2 GB到1.5 GB之间的堆。

A similar question was asked here. 在这里提出了类似的问题。 How much -XX:MaxPermSize size i can mention for 4GB and 8GB Ram and calculation for this? 我可以提及4GB和8GB Ram的-XX:MaxPermSize大小是多少,并为此进行计算?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM