Default Java Heap Size

If you don't specify anything with -Xmx and -Xms, how much memory will the operating system allocate to your Java process?

The default heap size was 64MB until Java 5. Since then, it's been calculated runtime. To see what the JVM will pick for your system, you can do:

$ java -XX:+PrintFlagsFinal -version 2>/dev/null |
  grep InitialHeapSize |
  awk '{print $4}' |
  numfmt --to iec
498M

To read more about how this value is calculated, see Garbage Collector Ergonomics


~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert