Metaspace is Java 8's new memory space for storing class meta-data information, and that grows automatically unlike its predecessor PermGen space.
Questions tagged [metaspace]
98 questions
133
votes
5 answers
What is the difference between PermGen and Metaspace?
Until Java 7 there was an area in JVM memory called PermGen, where JVM used to keep its classes. In Java 8 it was removed and replaced by area called Metaspace.
What are the most important differences between PermGen and Metaspace?
The only…

Kao
- 7,225
- 9
- 41
- 65
51
votes
2 answers
java8 "java.lang.OutOfMemoryError: Metaspace"
After switching our java application (services running on Tomcat) JRE from Java 7 to Java 8, we started to see java.lang.OutOfMemoryError: Metaspace after running a few days with high traffic volume.
Heap usage was OK. Metaspace jumps after…

Jane
- 621
- 1
- 6
- 10
38
votes
2 answers
How to diagnose a Java 8 metaspace leak?
I have a J2EE application with some interesting behavior ... the heap seems to behave well, growing and shrinking with garbage collections as expected over time. There is no appreciable overall long term heap expansion. However, the metaspace just…

It Worked Yesterday
- 381
- 1
- 3
- 5
25
votes
2 answers
How to get Java8 Metaspace dump (not heap dump)
Are there any tools that are able to get Metaspace dump from a Java8 hotspot vm ?

czh
- 395
- 1
- 3
- 8
22
votes
1 answer
Understanding metaspace line in JVM heap printout
In a Java 8 heap printout, you may see a line that looks like:
Metaspace used 2425K, capacity 4498K, committed 4864K, reserved 1056768K
https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/considerations.html tries to explain…

J. Smith
- 223
- 1
- 2
- 5
22
votes
2 answers
Java 8: Why does Metaspace size increase but number of loaded classes stay the same?
In our app running on Jdk 8 we use VisualVM to track the usage of loaded classes and the usage of the metaspace.
At some point in time while our app is running we see that the number of loaded classes don't increase any more but the metaspace still…

Chris W.
- 2,266
- 20
- 40
18
votes
3 answers
Guidelines to set MetaspaceSize - java 8
What is the default value of MetaspaceSize for 64-bit servers? I couldn't find it in the official documentation.
I'm observing that in a server JVM process, at times, the GC frequency becomes high and keeps growing. If I restart the service a few…

A.R.K.S
- 1,692
- 5
- 18
- 40
18
votes
3 answers
java 8 find out size of metaspace at runtime
Java 8 uses metaspace that is capable of expanding dynamically. GC will run on metaspace when its getting full. Does that mean GC will never run on metaspace?
My Java 8 application is using a LOT of memory. I would like to know what is the size of…

hrishikeshp19
- 8,838
- 26
- 78
- 141
16
votes
2 answers
Java8 metaspace & heap usage
I have this code to generate class dynamically and load it
import javassist.CannotCompileException;
import javassist.ClassPool;
public class PermGenLeak {
private static final String PACKAGE_NAME = "com.jigarjoshi.permgenleak.";
public…

jmj
- 237,923
- 42
- 401
- 438
13
votes
2 answers
Why is heap memory going up together with metaspace in Java 8?
I'm doing a little test to understand how metaspace memory (Java 8 onwards) works.
When I create 100,000 classes dynamically the metaspace memory is growing (obviously) but heap memory is going up too.
Can someone explain to me why this occurs?
PS:…

Andre
- 133
- 3
12
votes
1 answer
Difference between Metaspace and Native Memory in Java
What is the difference between Metaspace and Native memory?
Metaspace can be tracked using jconsole, jvisualvm, jstat cmds.
It seems Native Memory can be tracked using jcmd. Link
Is metaspace also Native Memory?
Where do NIO buffers get stored? In…

prem kumar
- 5,641
- 3
- 24
- 36
9
votes
3 answers
How to determine the ideal size for an Metaspace for java 8
We are migrating our web application from Java 7 to Java 8. We had defined the PermSize jvm param arguments.
Since Java 8 will ignore this parameters, this are none of use. Metaspace is introduced in Java 8 and default size of it is…

Rishikesh Darandale
- 3,222
- 4
- 17
- 35
9
votes
2 answers
Metaspace memory concumption issues of Java 8 applications deployed on Wildfly 8.2.1
Issue description
I noticed that each deployment of one of our Java8 application on Wildfly 8.2.1 uses approximately 30-40 MBs from Metaspace memory pool. That is fine, but the thing is that once I am redeploying the same app the Metaspace memory…

Andrei
- 303
- 3
- 7
9
votes
1 answer
Java 8 metaspace garbage collection
A java process that I'm running performs consistently well in the first hour or so that it runs. However, performance then rapidly degrades. When profiling I found that the metaspace garbage collection happened fairly frequently until the hour mark…

user1675642
- 747
- 2
- 5
- 15
8
votes
1 answer
After upgrading to Gradle 5 and Android Plugin 3.3, my build fails with "Metaspace"
This happened when I upgraded to Gradle 5.0 from 4.10.3, and also the Android Gradle Plugin from 3.2.1 to 3.3.0-rc03 (the latter because it's the first version of AGP to officially support Gradle 5).
When I attempt to sync my project after this, I…

AutonomousApps
- 4,229
- 4
- 32
- 42