Home > Java > javaTutorial > body text

What Replaced PermGen in JDK 8 and How Does It Work?

Susan Sarandon
Release: 2024-11-19 01:04:02
Original
645 people have browsed it

What Replaced PermGen in JDK 8 and How Does It Work?

Eliminating PermGen in JDK 8

Upon upgrading to JDK 8, you may encounter a warning message while attempting to launch Eclipse. This warning indicates that the "MaxPermSize" Java Virtual Machine (JVM) option is being ignored due to its removal in JDK 8.

Reasons for Ignoring "MaxPermSize"

The Permanent Generation (PermGen) space, managed by the "MaxPermSize" option, has been removed from HotSpot in JDK 8. This was primarily due to several drawbacks:

  • Fixed size at startup, making it difficult to adjust.
  • Opaque and weakly typed, leading to debugging challenges.
  • Limited future improvements due to its constraints.

MetaSpace: A Replacement for PermGen

PermGen has been replaced by Metaspace, a new space that addresses these drawbacks. Metaspace offers several advantages:

  • Class loader-specific storage areas, simplifying allocation.
  • Linear allocation and no individual reclamation, enhancing efficiency.
  • No GC scanning or compaction, reducing overhead.
  • Unlimited default size, avoiding potential memory constraints.

Metaspace Tuning

While Metaspace's maximum size is typically unlimited, you can set it using the "-XX:MaxMetaspaceSize" flag. Additionally, "-XX:MetaspaceSize" defines its initial size. If unspecified, Metaspace will dynamically adjust based on runtime demand.

In conclusion, the elimination of PermGen and the introduction of Metaspace in JDK 8 have resulted in improved GC performance and simplified runtime management. Developers should be aware of the deprecation of the "MaxPermSize" option and its implications for their applications.

The above is the detailed content of What Replaced PermGen in JDK 8 and How Does It Work?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template