-XX: MaxPermSize with or without -XX: PermSize

We encountered the error Java.lang.OutOfMemoryError: PermGen space and consider the JVM tomcat options, except for the -Xms and -Xmx , which we also specify -XX:MaxPermSize=128m , After a little profiling I sometimes see garbage collection in PermGen space, saving her from full work.

My question is: besides increasing -XX:MaxPermSize what's the difference if I also specify -XX:PermSize ? I know that the shared memory will then be Xmx + maxPermSize , but is there another reason why -XX:PermSize should not be there when -XX:MaxPermSize ?

Please share if you have real experience with these JVM parameters.

ps. JVM is the server-side VM version of HotSpot 64-bit 16.2-b04

+48
java jvm permgen jvm-hotspot
Dec 02 '11 at 12:35
source share
3 answers

-XX:PermSize specifies the initial size to be allocated when starting the JVM. If necessary, the JVM will allocate up to -XX:MaxPermSize .

+42
Dec 02 '11 at 12:44
source share

-XX:PermSize playing with the -XX:PermSize and -Xms , you can tune performance - for example, launching your application. I did not look at it recently, but a few years ago the default -Xms was something like 32 MB (I think) if your application needed a lot more than this would cause several memory cycles - full garbage collection - increase memory etc., until he has downloaded everything he needs. This cycle can be detrimental to startup performance, so immediately assigning the required number can improve startup.

A similar cycle applies to the permanent generation. Thus, setting these parameters can improve startup (in particular).

WARNING The JVM has a lot of optimizations and intelligence when it comes to allocating memory, dividing space and old generations, etc., so don't do things like -Xms equal to -Xmx or -XX:PermSize equal to -XX:MaxPermSize , because it will remove some of the optimizations that the JVM can apply to its distribution strategies, and to do so reduce the performance of your application, rather than improve it.

As always: take non-trivial measurements to prove that your changes actually improve overall performance (for example, improving startup times can be disastrous for performance while using the application)

+25
Dec 02 '11 at 2:59 p.m.
source share

If you are doing some performance tuning, it is often recommended that both -XX:PermSize and -XX:MaxPermSize be set to the same value to improve JVM performance.

Here is some info:

You can also specify -XX:+CMSClassUnloadingEnabled to enable class unloading if you use -XX:+CMSClassUnloadingEnabled CMS . This may help reduce the likelihood of Java.lang.OutOfMemoryError: PermGen space

+7
Dec 02 '11 at 16:15
source share



All Articles