tags:

views:

323

answers:

4

We have PC with Windows with 2048 RAM.
We try to use next memory settings for JBoss:
-Xms256M -Xmx768M -XX:MaxPermSize=256M

But it cannot start:

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.

JBoss starts only if we change -Xmx768M to -Xmx512M.

What can be the problem?

Update: Now we use next settings
-Xms512M -Xmx768M -XX:MaxPermSize=156M

A: 

Interesting. What happens when you set max memory to 513M?

If that fails, it's possibly a problem I haven't seen in quite a while. An ancient COBOL compiler I used refused to work on PCs with 640K of RAM because they used a signed-number check to decide if there was enough memory.

And in that world, 640K actually had the high bit set, hence was a negative number, so the check always failed.

I find it hard to believe that this would be the case in todays world but it may be worth looking at.

If it doesn't fail at 513M, then it may just be that you're trying to allocate too much memory. It's not necessarily physical memory that matters, address space may be the issue but you should have 2G (at least) of that as well in 32bit Windows.

With your settings shown, you use 1G just for permgen and heap. Try adjusting these until it works and post the figures you have.

paxdiablo
A: 

There are two possible causes:

  • JVM couldn't find 768 MiB continuous region in the address space or
  • total size of free area on your RAM and paging file is less than 1 GiB.

(JVM checks them using -Xmx and -XX:MaxPermSize on startup because of GC implementation)

As you could -Xmx768m -XX:MaxPermSize156m, the latter is doubtful.

If so, the problem might be resolved by freeing RAM (e.g., stopping unused services) or extending paging file.

habe
We set size of paging file to 4096M.
Vladimir Bezugliy
BTW, this is not overloaded PC.We use it for JBoss only.
Vladimir Bezugliy
Sorry, my guess may be wrong.As paxdiablo says, it must be a problem on address space.According to Sun's FAQ, (normally) we can use up to 1.4 GiB of heap+perm in 32 bit JDK on Windows.Your PC might have something (such as DLL in the middle of address space) causes address fragmentation so that you can allocate less than 1 GiB.(c.f. http://java.sun.com/docs/hotspot/HotSpotFAQ.html#gc_heap_32bit)
habe
A: 

maybe you can reboot your pc and try again. you can't allocation the memory more than your total physical memory.

tiantian
A: 

-Xms256M -Xmx768M -XX:MaxPermSize=256M should only be trying to grab 512M at most on initialization plus about 100M for the JVM process itself. Do you have that much free memory on the machine? We always run jboss on machines with 4G because the DB takes up quite a bit as well.

Here's a trick you can use to find the max amount you can set. You can simply run

java -version -Xms256M -Xmx768M -XX:MaxPermSize=256M

And then increase/decrease values until you find the max the JVM will let you set.

BTW, on a 4G 32-bit windows box, we usually set -Xms768M -Xmx1300M -XX:MaxPermSize=256M

karoberts