When I shutdown a Tomcat, I receive the following message:
"Error occurred during initialization of VM
Could not reserve enough space for object heap"
The setting I have for memory allocation is "-Xmx2048m -Xms2048m".
I can't understand why the message appears as I have ample RAM: 4GB.
Server stats:
Sun V240
Operating System: Solaris 9
RAM: 4GB
Gilbert - 24 Apr 2008 22:12 GMT
> When I shutdown a Tomcat, I receive the following message:
>
[quoted text clipped - 10 lines]
> Operating System: Solaris 9
> RAM: 4GB
I've seen this before on Windows boxes when initialising the JVM. There
appears to be a limit to the memory the JVM can address. The JVM version we
were using wouldn't start with -XMX much over 1.7GB as I remember.
However, this doesn't explain why you are seeing this when you shutdown
Tomcat.
Owen Jacobson - 24 Apr 2008 22:15 GMT
> When I shutdown a Tomcat, I receive the following message:
>
[quoted text clipped - 4 lines]
>
> I can't understand why the message appears as I have ample RAM: 4GB.
On Windows, any *process* (not thread) is only allowed to allocate at
most 2GB of address space[0]. The JVM does not use any of the memory-
mapping tricks[1] necessary to access more than 2GB of RAM through a
smaller address space range, so the JVM, in turn, can allocate at most
2GB of RAM. This includes the memory required to map in the JVM code
and to set up the stack, as well as the JVM's object heap and relevant
bookkeeping data.
So the most RAM you can assign to the JVM on Windows is going to be
somewhat less than 2048 MB.
Note that this limit is per-process; thus, a machine with 32GB of
physical RAM is able to use all of it, but any one program can only
use at most 2GB of it.
Windows' in-process code and data occupies the "other" 2GB of the 4GB
32-bit address space.
[0] Or 3GB if Windows was started with the /3GB switch. See <http://
blogs.msdn.com/oldnewthing/archive/2004/08/22/218527.aspx> for a very
thorough discussion of the tradeoffs involved.
[1] Shades of bank-switched memory...
Steve Wampler - 24 Apr 2008 22:33 GMT
>> I can't understand why the message appears as I have ample RAM: 4GB.
>
> On Windows, any *process* (not thread) is only allowed to allocate at
> most 2GB of address space[0].
Isn't the OP running Solaris and not Windows? Maybe JVMs have the
same issue on Solaris 9?

Signature
Steve Wampler -- swampler@noao.edu
The gods that smiled on your birth are now laughing out loud.
Patricia Shanahan - 24 Apr 2008 23:05 GMT
> When I shutdown a Tomcat, I receive the following message:
>
[quoted text clipped - 10 lines]
> Operating System: Solaris 9
> RAM: 4GB
Are you running a 32 bit or 64 bit JVM?
Patricia
Roedy Green - 25 Apr 2008 03:42 GMT
>The setting I have for memory allocation is "-Xmx2048m -Xms2048m".
>
>I can't understand why the message appears as I have ample RAM: 4GB.
First, what is the address space per task on that architecture. 2G 4G?
Consider also how much other junk fits in that address space, possibly
the OS, your code, your stacks. There is precious little left for the
heap.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Nigel Wade - 25 Apr 2008 09:53 GMT
> When I shutdown a Tomcat, I receive the following message:
>
[quoted text clipped - 10 lines]
> Operating System: Solaris 9
> RAM: 4GB
I think that in 32bit Solaris a process can be up to 4GB (I don't have any 32bit
Solaris boxes with sufficient memory to verify this), so a 2GB heap ought to be
ok. Are you using 32 or 64bit Solaris (I think the 240 can run 64bit), if it's
64bit then this is probably not the issue.
But, check your ulimit for virtual memory. That may be restricting the maximum
memory you are allowed to allocate.

Signature
Nigel Wade
Eric Sosman - 25 Apr 2008 13:46 GMT
>> When I shutdown a Tomcat, I receive the following message:
>>
[quoted text clipped - 15 lines]
> ok. Are you using 32 or 64bit Solaris (I think the 240 can run 64bit), if it's
> 64bit then this is probably not the issue.
The virtual address space for a 32-bit process on Solaris
(SPARC; x86/x64 is different) is about 3.996GB; there are "holes"
of 64KB at the low end and 4176KB at the high end. Usually a
process loses a little more space to things like "guard pages;"
I don't know how much fragmentation the JVM incurs. (The O.P.
could use "pmap" against his running JVM to see the details.)
> But, check your ulimit for virtual memory. That may be restricting the maximum
> memory you are allowed to allocate.
This is possible, but it seems unlikely: His memory settings
are probably the same for all the programs he runs, and if ulimit
were capping his usage you'd expect none of his other Java stuff
would run, either.
I'm afraid I don't have a clue about what exactly goes on
during Tomcat shutdown, but one thing that *might* be worth
checking is the amount of swap space configured on the system.
The O.P. says he's got 4GB of physical memory, and if Tomcat is
already running and there's not much swap space, it may be that
the swap is oversubscribed. (Solaris doesn't "overcommit" swap
space as freely as some other operating systems do.)

Signature
Eric Sosman
esosman@ieee-dot-org.invalid