Message "Could not reserve enough space for Object heap" in JVM

Asked

Viewed 1,924 times

6

So I wanted to know the limitation for memory allocation to the JVM depending on the operating system and processor architecture. If, as you set it, you lower the maximum value of the perm-size to a lower value, you can increase Java further heap size?

Example:

On Windows 32bits

I had configured Java MaxPermSize with 512m, this allowed me to leave up to ~1024m of heap size

Then I changed the Java MaxPermSize to 256m, I managed to put the heap Size up to ~1200m.

Already in windows 64 with Java Jdk 64bits did not have this problem, only if it uses java JDK 32bits.

If someone knows about documentation, please also send a link.

1 answer

5

As the limit of 32bit systems is 4GB of RAM and the system needs memory for Swap, kernel among others the practical limit is around 1.4GB to 1.6 GB (source).

Relationship between Permsize and Heapsize:

traditional heap = objects

perm heap = definitions of classes

That is, the perm heap is an additional space separated from the conventional heap space (for objects). Soon the larger the space you set for it the more space will occupy the system and this will limit as much as your system will allow for the conventional heap.

Therefore the Perm heap is not included in the heap (Xmx) but it can limit it by consuming an additional space of the system that in a 32bit system will be much more limited than in a 64bit.

Exemplifying: 512Mb + 1024Mb = 1.5Gb (total space your system allowed for the JVM) which as you can see is in the range described at the beginning of this response.

See the official documentation on the oracle.

The table below shows how to define these options in the JVM

+-----------------+----------------------------------------+---------------------+
| Opção da JVM    | Significado                            | Exemplo             |
| -Xms            | heap size inicial da JVM               | -Xms3072M           |
| -Xmx            | tamanho máximo do heap da JVM          | -Xmx16G             |
| -XX:PermSize    | tamanho inicial do espaço permanente   | -XX:PermSize=128k   |
| -XX:MaxPermSize | tamannho máximo do espaço permanente   | -XX:MaxPermSize=256m|
+-----------------+----------------------------------------+---------------------+

I believe it is useful to have this table in an answer about Ssosince I suspect that not everyone knows how to set up such elements

Browser other questions tagged

You are not signed in. Login or sign up in order to post.