2

JDK on Windows takes max around 2 GB RAM. Even if we allocate more RAM to our JDK; it doesnt take it. If I need to run a process which need 8 GB RAM on Windows; how can I achieve it ?

Do we have any JDK provided by any other provider which could support it ? Memcached provides us additional cache which can be used... but that is not I am looking for. Suppose I need to run my jMeter with 8 GB RAM on my windows box; Memcached wont help for sure.. Is there any provider which provides me with this ? Previosly I thought Terracotta does that; but looks like that also is like Memcached.

I am using Windows 7. If needed I can use Windows Server also.. I just need to get it running.

2
  • 2
    You should tell which version of Windows you do use, anyway it feels more like a question for serverfault.
    – SJuan76
    Dec 14, 2012 at 10:06
  • 3
    32 bit or 64 bit jdk? you need 64 bit to get more than 2 gigs Dec 14, 2012 at 10:09

5 Answers 5

3

As far as I know there is a 2GB memory limit per 32 bit process on Windows. However this page seems to indicate there are register settings to expand that to 3GB. Specifically IMAGE_FILE_LARGE_ADDRESS_AWARE

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

3
  • never seen that problem on a 64 bit machine. I have a java server with 8GB xmx on windows
    – Roman K
    Dec 14, 2012 at 10:11
  • 2
    As the page you linked to explains, this limit exists only for 32-bit processes. With a 64-bit JRE on 64-bit Windows you won't have this problem.
    – Jesper
    Dec 14, 2012 at 10:15
  • Exactly @Jesper, my original answer was.... crap... (to be nice to myself) I was clarifying as you commented. :)
    – Kevin D
    Dec 14, 2012 at 10:17
2

using 64bit JDK on 64bit OS fixes it

1

I have sucessfully used 12G (-Xmx12G) on my 64 bit windows machine, and the (64 bit) JVM used every byte of it.

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.

1

If you use -ms8g -mx8g and it starts correctly then it has a "minimum" heap size of 8 GB. However, If your program doesn't use 8 GB it still might be only 2 GB or less. i.e. A hello World program will not use 8 GB no matter what settings you give it. (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. It can still use 64-bit or even 128-bit data. 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)

It is worth noting that a 64-bit JVM still uses 32-bit references up to a heap size of about 30 GB. i.e. the references are not plain memory addresses as they are for a 32-bit program.

0

If you have huge amount of cached data, they better reside out of java heap. Otherwise, GC will spend lots of time traversing it, repeatedly and fruitlessly.

Terracotta's BigMemory does that by putting data in direct ByteBuffer, which is outside Java heap. Maybe there are free/open ones too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.