-
1. Re: JBoss OutOfMemoryError - Help needed regarding Heap Size
peterj Jul 23, 2008 12:27 PM (in response to jkv)What operating system, are you using? I will assume Windows, and that it is 32-bit. In that case, you can only allocate around a 1.5GB heap.
Also, what kind of OOME are you getting? See http://wiki.jboss.org/wiki/OutOfMemoryExceptions for suggested fixes.
Based on your description, I am guessing that it is not a permgen space problem (those usually happen when you redeploy an app). In which case you probably have a memory leak somewhere in your application. You might want to monitor heap usage. See my presentation at http://www.cecmg.de/doc/tagung_2007/agenda07/24-mai/2b3-peter-johnson/index.html for some suggestions. -
2. Re: JBoss OutOfMemoryError - Help needed regarding Heap Size
jkv Jul 24, 2008 8:09 AM (in response to jkv)Thanks Peter. That was a great post! I am looking on to your presentation and checking to see if I can optimize my GC. BTW I am using Window XP as my platform, and is there a relation between the operating system word length and the maximum heap size that can be allocated?? Do we have any statistical relation for it?
If I consider my OS to be 32 bit then I should be allowed to set a Maximum heap size 1.5GB which is 1536m (to be in multiples of 512m). If thats the case I am getting error for this statement
Xms1536m -Xmx1536m.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Press any key to continue . . . -
3. Re: JBoss OutOfMemoryError - Help needed regarding Heap Size
peterj Jul 24, 2008 11:50 AM (in response to jkv)The maximum heap you allocate depends on the operating system, even the patches to the operating system, the amount of RAM and swap space available, and the other DLLs that are loaded into the JVMs address space.
For example, on a machine with 1GB RAM and 1GB swap space, you probably will not have enough free memory available to allocate 1.5GB.
Another example: I recall that a certain software registered a lot of performance statistics, so when I ran the JVM I saw a lot of that software's DLLs in the JVM address space. One way you can check what DLLs are loaded with your JVM is with the listdlls or Process Explorer tools from SysInternals. Look at where the DLLs are loaded into memory - the JVM always allocates the heap in one contiguous block so you can only allocate as much heap as the largest free memory block. -
4. Re: JBoss OutOfMemoryError - Help needed regarding Heap Size
harkconnen Sep 26, 2011 6:03 PM (in response to peterj)Hi Petter,
According to your comments, using Windows Server 2003 32bits there is a top limit of 1.5gb for HEAP.
I'm having these message after executing run.bat
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
When using this set line on RUN.BAT it works OK
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1600m
But when using this set line on RUN.BAT it fails
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1700m
I need to increase JVM memory up to 2GB, is there a way to ? using Windows Server 32bits?
Thanks!
Kind regards
Juan Chicchón
From Lima, PERÚ
-
5. Re: JBoss OutOfMemoryError - Help needed regarding Heap Size
peterj Sep 26, 2011 8:18 PM (in response to harkconnen)No, you cannot do that, not with the 32-bit Hotspot JVM. That JVM requires a large contiguous memory area to hold the heap. The way Windows lays out the memory, the top 2GB is address space is reservered for the OS. Immediatly underneath is where the various Win32 DLLs get loaded. The JVM DLL gets loaded just under that. The lower portion of memory is used by some legacy stuff and by java.exe itself. And then you need to provide some space for the permgen and also space for the thread stack. Thus you are left with 1.6GB. Even if you boot Windows with the /3G option, you will not get a much larger heap because the extra space is above the DLLs and is not contiguous with the lower memory where the heap is allocated. My company once created a JVM that did not need a contiguous heap space; it could allocate around 2.6GB of heap on 32-bit Windows. But then we usually ran out of room for in the OS space (where file handles, thread handles, and other things are kept).
If you really want 2GB heaps, you will need to run a 64-bit OS and a 64-bit JVM. (Though I recall some Linux users claiming 2GB heaps with a 32-bit JVM.)