From what I know, starting with JDK 8 the PermGen will be a past page in java's history. Everything nice and merry... but what will the new Memory Layout look like? Will this affect GC on the new platform?
Asked
Active
Viewed 3.7k times
31
-
10Note that "Java Memory Model" has [a *very specific meaning*](http://stackoverflow.com/tags/java-memory-model/info) which is not really related to what you're asking. Yes, the name is confusingly similar to what you're asking. – Joachim Sauer Dec 13 '13 at 09:36
2 Answers
38
PermGen is replaced with Metaspace in Oracle/Sun JDK8, which is very similar. The main difference is that Metaspace can expand at runtime.

Adam Dyga
- 8,666
- 4
- 27
- 35
-
OK...so how much can it grow? is it bound by just the maximum amount of memory a java process can have? – Olimpiu POP Dec 13 '13 at 09:45
-
3@user503413 Based on the link I provided: "By default class metadata allocation is limited by the amount of available native memory (capacity will of course depend if you use a 32-bit JVM vs. 64-bit along with OS virtual memory availability)." It can be also limited with `MaxMetaspaceSize` parameter – Adam Dyga Dec 13 '13 at 09:50
25
This is when permGen is there
After Metaspace is introduced
Definitely, there is lot of improvement in GC in Java 8. You can check this stackoverflow post
In Metaspace, multiple mapped virtual memory spaces are allocated for metadata and allocation ( in chunks) is per class loader depending on the type of classloader and its liveness . Chunks are returned to free chunks list and also virtual memory spaces returned when emptied.
Advantage of GC would be
- During full collection, metadata to metadata pointers are not scanned
- A lot of complex code (particularly for CMS) for metadata scanning was removed.
- Metaspace contains few pointers into the Java heap.
- No compaction costs for metadata
- Reduces root scanning (no scanning of VM dictionary of loaded classes and other internal hashtables).

Martijn Pieters
- 1,048,767
- 296
- 4,058
- 3,343

pardeep131085
- 5,468
- 2
- 21
- 9
-
Can you please clarify what are the 'VM metadata' exactly? Also what are so-called 'Internal Hotspot types' and how they have been affected? – Andrey M. Stepanov May 20 '18 at 21:48