PermGen elimination in JDK 8
Asked Answered
D

6

244

I have installed JDK 8 and trying to run Eclipse. I am getting following warning message:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m;
support was removed in 8.0 

What are the reasons for ignoring this VM option?

Diondione answered 20/8, 2013 at 15:56 Comment(1)
You might find this informative: javaeesupportpatterns.blogspot.co.uk/2013/02/…Maggard
C
375

Reasons of ignoring these argument is permanent generation has been removed in HotSpot for JDK8 because of following drawbacks

  • Fixed size at startup – difficult to tune.
  • Internal Hotspot types were Java objects : Could move with full GC, opaque, not strongly typed and hard to debug, needed meta-metadata.
  • Simplify full collections : Special iterators for metadata for each collector
  • Want to deallocate class data concurrently and not during GC pause
  • Enable future improvements that were limited by PermGen.

The Permanent Generation (PermGen) space has completely been removed and is kind of replaced by a new space called Metaspace. The consequences of the PermGen removal is that obviously the PermSize and MaxPermSize JVM arguments are ignored and you will never get a java.lang.OutOfMemoryError: PermGen error.

Advantages of MetaSpace

  • Take advantage of Java Language Specification property : Classes and associated metadata lifetimes match class loader’s
  • Per loader storage area – Metaspace
  • Linear allocation only
  • No individual reclamation (except for RedefineClasses and class loading failure)
  • No GC scan or compaction
  • No relocation for metaspace objects

Metaspace Tuning

The maximum metaspace size can be set using the -XX:MaxMetaspaceSize flag, and the default is unlimited, which means that only your system memory is the limit. The -XX:MetaspaceSize tuning flag defines the initial size of metaspace. If you don’t specify this flag, the Metaspace will dynamically re-size depending of the application demand at runtime.

Change enables other optimizations and features in the future

  • Application class data sharing
  • Young collection optimizations, G1 class unloading
  • Metadata size reductions and internal JVM footprint projects

There is improved GC performace also. More Details

Condemnation answered 19/3, 2014 at 14:55 Comment(2)
I should mention that interned strings were previously stored in the PermGen space, but were moved to the main Java heap in Java 7.Isotropic
A bit of gentle introduction for the general audience (I mean primarily non-Java folks, e.g. fellow devops having to deal with JVM) wouldn't harm in this answer.Shevat
H
118

This is one of the new features of Java 8, part of JDK Enhancement Proposals 122:

Remove the permanent generation from the Hotspot JVM and thus the need to tune the size of the permanent generation.

The list of all the JEPs that will be included in Java 8 can be found on the JDK8 milestones page.

Hypoxia answered 20/8, 2013 at 22:18 Comment(0)
B
21

The Permanent Generation (PermGen) space has completely been removed and is kind of replaced by a new space called Metaspace.The consequences of the PermGen removal is that obviously the PermSize and MaxPermSize JVM arguments are ignored and you will never get a java.lang.OutOfMemoryError: PermGen error. The JDK 8 HotSpot JVM is now using native memory for the representation of class metadata and is called Metaspace. Read More>>

Baseburner answered 30/4, 2014 at 13:4 Comment(1)
'HotSpot JVM is now using native memory for the representation of class metadata. - and what memory HotSpot JVM used previously? And what is the 'native memory' exaclty?Impartial
K
17

Because the PermGen space was removed. Memory management has changed a bit.

java-8-permgen-metaspace

Konrad answered 20/8, 2013 at 16:0 Comment(0)
T
13

PermGen space is replaced by MetaSpace in Java 8. The PermSize and MaxPermSize JVM arguments are ignored and a warning is issued if present at start-up.

Most allocations for the class metadata are now allocated out of native memory. * The classes that were used to describe class metadata have been removed.

Main difference between old PermGen and new MetaSpace is, you don't have to mandatory define upper limit of memory usage. You can keep MetaSpace space limit unbounded. Thus when memory usage increases you will not get OutOfMemoryError error. Instead the reserved native memory is increased to full-fill the increase memory usage.

You can define the max limit of space for MetaSpace, and then it will throw OutOfMemoryError : Metadata space. Thus it is important to define this limit cautiously, so that we can avoid memory waste.

Toadfish answered 17/1, 2017 at 5:17 Comment(0)
P
11

Oracle's JVM implementation for Java 8 got rid of the PermGen model and replaced it with Metaspace.

Peccable answered 20/8, 2013 at 15:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.