[英]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.