I have read a lot about java memory areas, but looks like it is just a mess. Mostly due to the introduction of a new MetaSpace
area instead of PermGen
- Does the structure of memory areas depend on the implementation of JVM ?
Absolutely. PermGen or Metaspace are just implementation details of a particular JVM. The following answers are about HotSpot JVM, the reference implementation of Java SE virtual machine.
- What areas does the heap include in java8+ ?
For the above reason it would be more correct to say "in JDK 8" rather than "in Java 8".
The structure of Java Heap depends on the selected GC algorithm. E.g. with Parallel GC and CMS the heap is divided into Old and Young generations, where the latter consists of Eden and two Survivor Spaces.
G1 Heap is divided into the regions of the same size. Epsilon GC heap is a single monolithic area. And so on.
- Where the static methods and variables are stored before java8 and java8+ ?
Methods (both static and non-static) reside in Metaspace in JDK 8 or in PermGen prior to JDK 8. Not sure what you mean by "variables": field values are in Java Heap, the field metadata (names, types, offsets) is in Metaspace.
- Does the MetaSpace store anything except class meta-data info ?
The following items are stored in Metaspace:
All of these can be considered "class metadata".