aspose file tools*
The moose likes JBoss/WildFly and the fly likes Maximum JVM Settings? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Maximum JVM Settings?" Watch "Maximum JVM Settings?" New topic
Author

Maximum JVM Settings?

Ed Schneider
Greenhorn

Joined: Mar 11, 2008
Posts: 4
I am running a Windows box with 4GB of RAM and JDK 1.6. I have nothing else running on the server. What is the maximum memory I can allocate to JBoss 4.0.1?

I currenlty startup JBoss with \bin\run.bat: set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1536m.

If I increase the -Xmx greater than 1536m, I get the following error on startup:

Error occurred during initialization of VM
Could not reserve enough space for object h
Could not create the Java virtual machine.
Press any key to continue . . .

Thanks!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

The largest possible heap size depends on the largest chunk of consecutive memory that the JVM can allocate (not all JVM need consecutive memory, but Sun's does). If you are running a 32-bit JVM on a 32-bit OS, then you need to understand how memory is laid out. Each app has only 4GB of addressable space. Typically, the OS uses 2GB and lets the app have the other 2GB. The app's address space it used up by usually by the exe in low memory and the OS DLLs in high memory just under the 2GB border (even the JVM DLLs load up into high memory). This leaves about a 1.5GB contiguous area in memory where the JVM can allocate the heap. The actual size grows and shrinks depending on the OS version and patches.

There is a /3GB os boot option you can use to split the app's memory such that the OS uses only 1GB and the app gets 3GB. Unfortunately, the OS DLLs (and JVM DLLs) still occupy the area just under 2GB, so you still end up with only 1.5GB of contiguous space. If you use a JVM that does not need contiguous memory to allocate the heap you can get about 2.7GB heaps. Of course, the /3GB options does have its down sides. Having only 1GB for its memory structures (threads, file handles, object handles, etc) can cause the OS to run out of resources. Usually you see this when the JVM is unable to create another thread. And app server create lots of threads.


JBoss In Action
Nirav Naik
Greenhorn

Joined: Jul 20, 2009
Posts: 4
I am also facing same problem. But on the same system I can run Tomcat with -Xms512m -Xmx1536m

Is this problem specific to JBoss only?


I do not seek. I find. - Pablo Picasso
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

What is the permgen size? A larger permgen means that the max heap size will be smaller.
Nirav Naik
Greenhorn

Joined: Jul 20, 2009
Posts: 4
I haven't specified any permgen size, It's considering default size.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

What operating system are you using? I assume that it is a 32-bit OS. What is the memory usage and availability at the time you launch Tomcat and JBoss AS? What is the full command line used to launch Tomcat and JBoss AS? What is the largest acceptable max heap size for JBoss AS? There are dozens of things that can affect how big a heap you can specify, so I will probably have you running lots of things and looking at various things to pinpoint this down.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Maximum JVM Settings?