Can Java access more than 2GB of memory on WIndows 32

Z

zigzagdna

I am getting an out of memeory exception error running a java program
on Windows 32 bit.
Memory on the box is 4GB (I know 32 bit can access up to 4GB but
Windows OS reserves 2GB for its own processes. I can increase memory
on this box from 4GB to 8GB, but my question is Java capable of
accessing this memory. In Windows memory beyond
4GB is accessible using /PAE switch and program has to be wriiten in
a ceratin way to use it, that's why my question is whether Java is
capable of accessing 8GB memory on Windows 32 bit?
 
M

Matt Humphrey

I am getting an out of memeory exception error running a java program
on Windows 32 bit.
Memory on the box is 4GB (I know 32 bit can access up to 4GB but
Windows OS reserves 2GB for its own processes. I can increase memory
on this box from 4GB to 8GB, but my question is Java capable of
accessing this memory. In Windows memory beyond
4GB is accessible using /PAE switch and program has to be wriiten in
a ceratin way to use it, that's why my question is whether Java is
capable of accessing 8GB memory on Windows 32 bit?

Java is limited to about 1.5-1.9 GB (YMMV) on Win 32 machines. You have to
shift up to 64-bit JVM on the appropriate hardware to get a larger range.

Matt Humphrey http://www.iviz.com/
 
A

Arne Vajhøj

I am getting an out of memeory exception error running a java program
on Windows 32 bit.
Memory on the box is 4GB (I know 32 bit can access up to 4GB but
Windows OS reserves 2GB for its own processes. I can increase memory
on this box from 4GB to 8GB, but my question is Java capable of
accessing this memory. In Windows memory beyond
4GB is accessible using /PAE switch and program has to be wriiten in
a ceratin way to use it, that's why my question is whether Java is
capable of accessing 8GB memory on Windows 32 bit?

Not from a single process (JVM).

64 bit !

Arne
 
D

Daniel Pitts

I am getting an out of memeory exception error running a java program
on Windows 32 bit.
Memory on the box is 4GB (I know 32 bit can access up to 4GB but
Windows OS reserves 2GB for its own processes. I can increase memory
on this box from 4GB to 8GB, but my question is Java capable of
accessing this memory. In Windows memory beyond
4GB is accessible using /PAE switch and program has to be wriiten in
a ceratin way to use it, that's why my question is whether Java is
capable of accessing 8GB memory on Windows 32 bit?
The Java virtual machine won't necessarily automatically allocate all of
your available memory, it has built in minimums and maximums.

If you're using Suns JVM, try adding -Xmx512M
That sets the max heap size to 512 megs. Experiment with that value.

Cation, don't set it too high either, as you'll degrade the performance
of your garbage collector.
 
Z

zigzagdna

The Java virtual machine won't necessarily automatically allocate all of
your available memory, it has built in minimums and maximums.

If you're using Suns JVM, try adding -Xmx512M
That sets the max heap size to 512 megs. Experiment with that value.

Cation, don't set it too high either, as you'll degrade the performance
of your garbage collector.

I am somewhat confused wih this switch, my progam is a third party
program which uses
Apache tomcat, so tomcat5 process is started and my third party
application is
integerated with tomcat. I see tomcat5 process started and I access
third part program's web site, thread count (increases for tomcat5 and
memory usgae increases. I will be suprised if tomcat5 cannot access
memory up to 2GB. Is max heap size per thread or for enitre jvm (i.e.
tomcat5 process).

Prem
 
Z

zigzagdna

Java is limited to about 1.5-1.9 GB (YMMV) on Win 32 machines. You have to
shift up to 64-bit JVM on the appropriate hardware to get a larger range.

Matt Humphreyhttp://www.iviz.com/

Windows OS has /3GB swtch which allows for 3GB user addressable space
(instead of 2GB),
so I will think java should be able to access close to 3GB (sighlt
less than 3GB). I do
not know where java heap size parameter comes into play as for as 2GB
or 3GB memory per process.
 
A

Arne Vajhøj

Windows OS has /3GB swtch which allows for 3GB user addressable space
(instead of 2GB),
so I will think java should be able to access close to 3GB (sighlt
less than 3GB). I do
not know where java heap size parameter comes into play as for as 2GB
or 3GB memory per process.

Java can not use that extra GB.

I assumes it has to do with that Java's memory need to be contiguous
and that something small just get in above the 2 GB mark.

64 bit !!

Arne
 
D

Daniel Pitts

I am somewhat confused wih this switch, my progam is a third party
program which uses
Apache tomcat, so tomcat5 process is started and my third party
application is
integerated with tomcat. I see tomcat5 process started and I access
third part program's web site, thread count (increases for tomcat5 and
memory usgae increases. I will be suprised if tomcat5 cannot access
memory up to 2GB. Is max heap size per thread or for enitre jvm (i.e.
tomcat5 process).

Prem
that switch is per JVM, in your startup scripts, you need to tune your
memory settings.
Java (and therefore tomcat) won't automatically allow all available
memory to be allocated, since this would add a performance bottleneck
for garbage collection.

Tomcat has a memory FAQ:
<http://tomcat.apache.org/faq/memory.html>
 
Z

zigzagdna

Java can not use that extra GB.

I assumes it has to do with that Java's memory need to be contiguous
and that something small just get in above the 2 GB mark.

64 bit !!

Arne

3GB swich gives contigous 3GB memory to user address space.
Basically in Windows 32 bit, of 4B - 2GB (contigous) is accessible by
kernel and other 2GB by user address space. With 3GB switch, kernel
uses only 1GB, so user address space has more memory (up to 3GB). This
is a soltion to provide more memory if one cannot switch to 64bit
which is the best solution.

I have used this feature in conjunction with Oracle. It does not
require any changes in one's
program. I will be really surprised if Java or any other application
cannot use it.
 
A

Arne Vajhøj

3GB swich gives contigous 3GB memory to user address space.
Basically in Windows 32 bit, of 4B - 2GB (contigous) is accessible by
kernel and other 2GB by user address space. With 3GB switch, kernel
uses only 1GB, so user address space has more memory (up to 3GB). This
is a soltion to provide more memory if one cannot switch to 64bit
which is the best solution.

I have used this feature in conjunction with Oracle. It does not
require any changes in one's
program. I will be really surprised if Java or any other application
cannot use it.

I know what /3GB does.

Read what I write.

Java can not use that extra GB.

I guess it is because something else it putting something
in around the 2 GB mark.

Arne
 
Z

zigzagdna

I know what /3GB does.

Read what I write.

Java can not use that extra GB.

I guess it is because something else it putting something
in around the 2 GB mark.

Arne- Hide quoted text -

- Show quoted text -
Arne:

Thanks. I am curious where it is documented it cannot use more than
2GB even when /3GB switch is on, just asking.
 
A

Arne Vajhøj

Thanks. I am curious where it is documented it cannot use more than
2GB even when /3GB switch is on, just asking.

I do not think I have ever seen an official statement.

But Google find a ton of references:
http://forum.java.sun.com/thread.jspa?threadID=576811
http://forum.java.sun.com/thread.jspa?threadID=621332
http://www.unixville.com/~moazam/

But when Googling I found this:
http://dev2dev.bea.com/blog/hstahl/archive/2005/12/how_to_get_almo.html

Sounds as if BEA JVM can handle a split heap and thereby utilize
the /3GB switch. Could be wort trying.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top