PermGen Removal in JDK 8: Why VM Option Ignored
Introduction
JDK 8 brought significant changes to Java Virtual Machine (JVM) architecture, including the elimination of the Permanent Generation (PermGen). This change has affected how Eclipse and other applications interact with the JVM.
Issue
When running Eclipse in JDK 8, users may encounter a warning message indicating that the MaxPermSize VM option is ignored. This message raises questions about the reasons for discarding this parameter.
Reasons for Ignoring MaxPermSize
The reasons for ignoring the MaxPermSize VM option stem from several drawbacks associated with PermGen in previous JDK versions:
-
Fixed Size: PermGen had a fixed size at startup, making it difficult to optimize memory allocation for applications with dynamic class loading needs.
-
Internal Hotspot Types: Objects stored in PermGen were Java objects, leading to potential memory leaks due to their persistence across garbage collections.
-
Simplified Collections: Removing PermGen allowed for the simplification of full garbage collection cycles, removing the need for special iterators for metadata.
-
Concurrent Class Data Deallocation: MetaSpace enables the concurrent deallocation of class data outside of GC pauses, improving performance.
-
Future Improvements: Elimination of PermGen paves the way for future JVM improvements and optimizations that were previously limited by its constraints.
Metaspace: The Replacement
In JDK 8, PermGen has been replaced by Metaspace, which offers several advantages:
-
Class Loader Affinity: Metaspace is associated with specific class loaders, ensuring that class lifetimes match the lifecycle of the corresponding loader.
-
Linear Allocation: Metaspace uses linear allocation, simplifying memory management.
-
No Individual Reclamation: Metaspace does not perform individual reclamation, except for class redefinition and loading failures, further reducing overhead.
-
No GC Scan or Compaction: Metaspace objects are not scanned or compacted during garbage collection cycles, improving performance.
-
Optimized Tuning: Metaspace can be tuned using -XX:MaxMetaspaceSize and -XX:MetaspaceSize flags, allowing for more flexible memory management.
Conclusion
The removal of PermGen in JDK 8 brings significant performance and stability benefits to Java applications. While the MaxPermSize VM option is no longer relevant, Metaspace provides a highly optimized and efficient solution for handling application metadata.
The above is the detailed content of Why is the MaxPermSize VM option ignored in JDK 8?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn