Exploring the Metaspace
The Metaspace is the memory space that holds the class metadata
that is necessary for runtime. It is the method area in the JVM specification and in most popular Java implementations after Java SE 7, this area is called the Metaspace.
If you know about PermGen, or you come across it, just know that this is the old memory area where all class metadata
was stored. It had some limitations and has been replaced by the Metaspace.
So, back to this class metadata
. What even is that? Class metadata
is the runtime representation of the Java classes that are necessary to run the program. It actually contains a lot of things, such as the following:
- The Klass structure (we’ll see more in Chapter 5 when we take a deep dive into the Metaspace!)
- Bytecode of methods
- The constant pool
- Annotations and more
That’s it! These are the basics of Java memory management. There is a lot more to say about the specific parts. We are going...