Re: Error occurred during initialization of VM
Man Alive wrote:
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.
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...