Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maximum JVM Settings?

 
Ed Schneider
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nirav Naik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the permgen size? A larger permgen means that the max heap size will be smaller.
 
Nirav Naik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't specified any permgen size, It's considering default size.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic