Which maximum max heap size (-Xmx) can be set?

What is the maximum value can I put to java as max heap size -Xmx ?

I have java for linux 32 and setting -Xmx2048m causes to OutOfMemory during JBoss startup

Reducing this value to 1G-1.7G solves this problem.

Is this value depends from Linux 32 or 64 if I run under java 32 ?

Comments

There are 3 types of OutOfMemory errors, can you lease post the FULL stack trace?
Did you get a "java.lang.OutOfMemoryError: Java heap space" OR "java.lang.OutOfMemoryError: max perm size" ( the maximum permanent generation size can be increased with MaxPermSize) OR maybe your heap size is larger than your computer's physical memory ???

Please post your FULL JBoss startup command

How much physical RAM is available on the machine?
You should also note that this allocation (Xmx ), is only for the HEAP. Additional space is allocated for the stack for each thread and if you have 100 threads this might sum to more than 100 MB, and more importantly there is memory allocated for the permanent generation (I think its about 256MB default).

With respect to your question about 32 and 64 BIT, just to make sure , are you running a 32BIT JVM on a 32BIT machine?

Once you provide me with more information i can start helping you.

I run java 32 on linux 32 and 64 with same OutOfMemory when -Xmx2048

Linux has 2G, 4G 8G

Reducing -Xmx to 1700m solves problem

Sometimes java crashes instead of OutOfMemory

I use default thread stack size.

Mark,
Unless you provide FULL answers to my questions I shall not be able to help you.

JAVA_OPTS="-XX:PermSize=64m -XX:MaxPermSize=256m -Xms512m -Xmx2048m"

Problem (OutOfMemory/crashe) happens on Linux only.

There are many articles say linux 32 process con not get more than 2G sequential memory.
IMHO it is not thread stack or permgen issue because it happens on startup.

In linux it's depend if your karnel support HugeMem or not.

For the size of memory os can allocate for each process.

Great,

It is very helpful

Thanks