Explain Codes LogoExplain Codes Logo

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize

java
memory-management
jvm-options
java-8
Anton ShumikhinbyAnton Shumikhin·Feb 26, 2025
TLDR

The warning is given because MaxPermSize isn't recognized anymore. From Java 8 onwards, PermGen is replaced by Metaspace. Instead of MaxPermSize, -XX:MaxMetaspaceSize is now used:

// Who needs perms when you got meta? 😎 -XX:MaxMetaspaceSize=256m

Ensure your MAVEN_OPTS in Maven projects are updated, removing -XX:MaxPermSize settings for seamless alignment with Java 8.

Unpacking metaspace

Java 8 rolled out with bucket-loads of memory model improvements, most notably the obliteration of PermGen space. Now class metadata lives in the native memory, amusingly known as Metaspace.

Metaspace versus permgen

When you switch from MaxPermSize to -XX:MaxMetaspaceSize, it's like replacing your old bicycle with a jet ski. You're not just changing your ride, but upgrading to an advanced, rip-roaring, and dynamic native memory management system.

Set it right

-XX:MaxMetaspaceSize is not a candy that you can have as much as you want:

  • Too much of it is like having too many pizzas at night, you will waste memory.
  • Too little of it is like having only a raisin for dinner, leaving your applications starving and throwing temper tantrums (OutOfMemoryError: Metaspace).
  • Default is your best friend, only part ways when long monitoring hours prove it wrong.

Evolving to Java 8

You don't only have to rm -rf -XX:PermSize and -XX:MaxPermSize from your life, but also make friends with heap size configs -Xms and -Xmx.

Love thy enterprise apps

Are you using JBoss EAP 6.4 or any other enterprise environment? Time to review your startup scripts and make sure they are shaking hands with Metaspace.

Metaspace performance hacks

Here are few sanity-saving tips for your memory frontier, the Metaspace:

  • Use -XX:MetaspaceSize to set the initial size of Metaspace, it's like setting up a decent initial basecamp before the big trek of memory allocation.
  • Tools like Java Mission Control are your eye-in-the-sky, feeding you crucial intel about the memory patterns in production.
  • OutOfMemoryError? panic not and heap dump it - it's as insightful as your favourite Sherlock Holmes novel.

As a developer, being informed about the hottest Java memory management trends is no longer optional.

Making necessary tweaks

A careful walkthrough of current JVM arguments and pom.xml files can reveal some forgotten relics of outdated settings. With Java 8 and onwards, updating the JVM options, and setting aside deprecated ones like MaxPermSize, can lead to cleaner runtime environment ensuring more effective memory management.