Windows XP上的Java最大内存 [英] Java maximum memory on Windows XP

查看:231
本文介绍了Windows XP上的Java最大内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直能够为在32位Windows XP(Java 1.4,1.5和1.6)上运行的Java SE分配1400兆字节。

I've always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6).

java -Xmx1400m ...

今天我尝试了一个新选项使用Java 1.5_16和1.6.0_07的Windows XP计算机出现错误:

Today I tried the same option on a new Windows XP machine using Java 1.5_16 and 1.6.0_07 and got the error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

通过反复试验,我可以在这台机器上分配1200兆字节。

Through trial and error it seems 1200 megabytes is the most I can allocate on this machine.

任何想法为什么一台机器允许1400而另一台只有1200?

Any ideas why one machine would allow 1400 and another only 1200?

编辑:这台机器有4GB内存Windows可以识别的3.5GB。

The machine has 4GB of RAM with about 3.5GB that Windows can recognize.

推荐答案

请记住,Windows具有虚拟内存管理,而JVM只需要连续的内存在其地址空间。因此,在系统上运行的其他程序不一定会影响您的堆大小。什么会妨碍你加载到你的地址空间的DLL。不幸的是,在链接期间最小化DLL重定位的Windows中的优化使得更有可能存在碎片化的地址空间。除了通常的东西之外,可能会切入你的地址空间的东西包括安全软件,CBT软件,间谍软件和其他形式的恶意软件。差异的可能原因是不同的安全补丁,C运行时版本等。设备驱动程序和其他内核位有自己的地址空间(4GB 32位空间的另外2GB)。

Keep in mind that Windows has virtual memory management and the JVM only needs memory that is contiguous in its address space. So, other programs running on the system shouldn't necessarily impact your heap size. What will get in your way are DLL's that get loaded in to your address space. Unfortunately optimizations in Windows that minimize the relocation of DLL's during linking make it more likely you'll have a fragmented address space. Things that are likely to cut in to your address space aside from the usual stuff include security software, CBT software, spyware and other forms of malware. Likely causes of the variances are different security patches, C runtime versions, etc. Device drivers and other kernel bits have their own address space (the other 2GB of the 4GB 32-bit space).

可以尝试在你的JVM进程中查看你的DLL绑定,并试着将你的DLL重新绑定到更紧凑的地址空间。不好玩,但是如果你绝望了......

You could try going through your DLL bindings in your JVM process and look at trying to rebase your DLL's in to a more compact address space. Not fun, but if you are desperate...

或者,您可以切换到64位Windows和64位JVM。尽管其他人建议,虽然它会占用更多的RAM,但你会有更连续的虚拟地址空间,并且连续分配2GB将是微不足道的。

Alternatively, you can just switch to 64-bit Windows and a 64-bit JVM. Despite what others have suggested, while it will chew up more RAM, you will have much more contiguous virtual address space, and allocating 2GB contiguously would be trivial.

这篇关于Windows XP上的Java最大内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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