简体   繁体   English

我如何在Windows上为我的JDK分配8 GB(不是1 GB)RAM

[英]How can I allocate 8 GB ( not 1 GB ) RAM to my JDK on windows

JDK on Windows takes max around 2 GB RAM. Windows上的JDK最多需要大约2 GB RAM。 Even if we allocate more RAM to our JDK; 即使我们为JDK分配了更多RAM; it doesnt take it. 它并不需要它。 If I need to run a process which need 8 GB RAM on Windows; 如果我需要在Windows上运行需要8 GB RAM的进程,请执行以下步骤: how can I achieve it ? 我怎么能实现它?

Do we have any JDK provided by any other provider which could support it ? 我们是否有任何其他支持它的提供商所提供的JDK? Memcached provides us additional cache which can be used... but that is not I am looking for. Memcached为我们提供了额外的缓存,可以使用......但这不是我想要的。 Suppose I need to run my jMeter with 8 GB RAM on my windows box; 假设我需要在Windows框上使用8 GB RAM运行jMeter; Memcached wont help for sure.. Is there any provider which provides me with this ? Memcached肯定不会有帮助。有没有提供给我这个的提供商? Previosly I thought Terracotta does that; 我以前以为兵马俑会那样做; but looks like that also is like Memcached. 但是看起来也像Memcached。

I am using Windows 7. If needed I can use Windows Server also.. I just need to get it running. 我正在使用Windows 7.如果需要,我也可以使用Windows Server ..我只需要让它运行。

在64位操作系统上使用64位JDK修复它

As far as I know there is a 2GB memory limit per 32 bit process on Windows. 据我所知,Windows上每32位进程有2GB内存限制。 However this page seems to indicate there are register settings to expand that to 3GB. 但是,此页面似乎表明存在一些寄存器设置,可以将其扩展到3GB。 Specifically IMAGE_FILE_LARGE_ADDRESS_AWARE 特别是IMAGE_FILE_LARGE_ADDRESS_AWARE

http://msdn.microsoft.com/en-gb/library/windows/desktop/aa366778(v=vs.85).aspx http://msdn.microsoft.com/en-gb/library/windows/desktop/aa366778(v=vs.85).aspx

So if you are using a 32bit JDK and stuck with it, that is is your best bet, however if you can upgrade to a 64 bit JDK do so, as if you use a 64 bit JDK on the a 64 bit version of windows this limit becomes 8TB 因此,如果您使用的是32位JDK并坚持使用,那是最好的选择,但是,如果可以升级到64位JDK,请这样做,就像在64位版本的Windows上使用64位JDK一样,限制变成8TB

If you use -ms8g -mx8g and it starts correctly then it has a "minimum" heap size of 8 GB. 如果使用-ms8g -mx8g且启动正确,则其“最小”堆大小为8 GB。 However, If your program doesn't use 8 GB it still might be only 2 GB or less. 但是,如果您的程序不使用8 GB,则可能仍然只有2 GB或更少。 ie A hello World program will not use 8 GB no matter what settings you give it. 即,无论您设置了什么设置,hello World程序都不会使用8 GB。 (Except an obscure one I don't think any uses ;) (除了一个晦涩的地方,我认为没有任何用处;)

What makes a 32-bit application, 32-bit is the limited address space it has. 使32位应用程序成为32位的是它具有的有限地址空间。 It can still use 64-bit or even 128-bit data. 它仍然可以使用64位甚至128位数据。 It is the limited amount of memory it can address which distinguishes it. 它可以寻址的有限内存量可以与众不同。 Windows uses allot of the address space for it's own purposes which means your real limit is about 1.2-1.5 GB for the heap (not 2^32 which is 4 GB) Windows为自己的目的使用地址空间的分配,这意味着堆的实际限制约为1.2-1.5 GB(而不是2 ^ 32,即4 GB)

It is worth noting that a 64-bit JVM still uses 32-bit references up to a heap size of about 30 GB. 值得注意的是,64位JVM仍使用32位引用,最大堆大小约为30 GB。 ie the references are not plain memory addresses as they are for a 32-bit program. 也就是说,引用不是普通的内存地址,就像32位程序一样。

I have sucessfully used 12G ( -Xmx12G ) on my 64 bit windows machine, and the (64 bit) JVM used every byte of it. 我已经在我的64位Windows计算机上成功使用了12G( -Xmx12G ),并且(64位)JVM使用了它的每个字节。

The only problem I stumbled upon was that sometimes it was needed to explicitely provide -d64 on the command line, event if it's a 64 bit JDK/JRE. 我偶然发现的唯一问题是,有时需要在命令行上明确地提供-d64 ,如果它是64位JDK / JRE则为事件。

If you have huge amount of cached data, they better reside out of java heap. 如果您有大量的缓存数据,则最好将它们驻留在Java堆之外。 Otherwise, GC will spend lots of time traversing it, repeatedly and fruitlessly. 否则,GC将花费大量时间遍历它,反复且毫无结果。

Terracotta's BigMemory does that by putting data in direct ByteBuffer, which is outside Java heap. Terracotta的BigMemory通过将数据放在Java堆之外的直接ByteBuffer来实现这一点。 Maybe there are free/open ones too. 也许也有免费/开放的。

暂无
暂无

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

相关问题 如何强制我的 JVM 进程始终占用 x GB 内存? - How do I force my JVM process to always occupy x GB ram? 如果要将JVM虚拟RAM设置为8GB,对物理RAM的最低要求是什么? - What is the minimum requirement of physical RAM if I want to set JVM virtual RAM 8GB? 在Windows 7 32bit RAM:4GB PC中安装Elastic Search 5.1.1 - Installation of elastic search 5.1.1 in windows 7 32bit RAM:4gb pc JVM-我应该分配多少RAM - JVM - How much RAM should I allocate 我在Linux上有一台8 GB RAM和32位JVM的机器,我想让JVM使用最大的RAM - I have a machine with 8 GB RAM with 32 bit JVM on linux and i want to make JVM to use maximum USE OF RAM 在具有8GB RAM的系统上无法设置超过4GB的XMX - unable to set xmx beyond 4gb on system having 8gb RAM 为什么我的垃圾收集日志显示3.8GB作为最大可用堆大小,而我已经分配了4GB作为最大堆大小? - Why does my garbage collection log show 3.8GB as the max available heap size while I have allocated 4GB as the max heap size? 将系统ram升级到16 GB时遇到错误:Java运行时环境已检测到致命错误: - upgrading system ram to 16 GB facing error : A fatal error has been detected by the Java Runtime Environment: 尽管RAM显示6 GB可用空间,但Java Runtime Environment的内存不足 - insufficient memory for the Java Runtime Environment to continue though RAM is showing 6 GB free space 使用具有超过120GB RAM的Concurrent Mark Sweep垃圾收集器 - Using Concurrent Mark Sweep garbage collector with more than 120GB RAM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM