From what I know, starting with JDK 8 the PermGen will be a 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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
PermGen is replaced with Metaspace in Oracle/Sun JDK8, which is very similar. The main difference is that Metaspace can expand at runtime.
回答2:
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).
More detail is here