
Note that it is no longer sufficient to just monitor the Heap Size. It is critical that you add the new option -XX:MaxMetaspaceSize which sets the Maximum Metaspace size for your application. This means you can literally take up all the memory on the Server. Why ? Because the native memory is only limited by the Operating System. The issue is, if your application loads lots of classes (and/or interned strings), you may actually bring down the Entire Server (not just your application). While you will NOT run out of PermGen space anymore (since there is NO PermGen), you may consume excessive Native memory making the total process size large. So, what is the significance of this change? Rather Metaspace is part of Native Memory (process memory) which is only limited by the Host Operating System. The key difference between PermGen and Metaspace is this: while PermGen is part of Java Heap (Maximum size configured by -Xmx option), Metaspace is NOT part of Heap. So no more OutOfMemory Errors due to PermGen Gone are the days of OutOfMemory Errors due to PermGen space. However, It is not unusal to see the error “ : PermGen space“ if you are loading unusual number of classes. Typically 256 MB should be more than enough of PermGen space for most of the applications The size of the PermGen space is configured by the Java command line option -XX:MaxPermSize If your application loads lots of classes, PermGen utilization will be high. Short form for Permanent Generation, PermGen is the memory area in Heap that is used by the JVM to store class and method objects. Oracle has completely gotten rid of ‘PermGen’ and replaced it with Metaspace. There is one major change in the Memory management area that I want to discuss today. As usual, tons of new features have been added. Oracle’s latest edition for Java – Java 8 was released in March 2014.
