Is JVM ARGS '-Xms1024m -Xmx2048m' still useful in Java 8?

后端 未结 2 638
傲寒
傲寒 2021-02-03 22:35

I have a Java 7 application using JVM ARGS: -Xms1024m -Xmx2048m, and it runs pretty well.

After I upgrade to Java 8, it runs in error state with Exception:<

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-03 23:05

    Due to PermGen removal some options were removed (like -XX:MaxPermSize), but options -Xms and -Xmx work in Java 8. It's possible that under Java 8 your application simply needs somewhat more memory. Try to increase -Xmx value. Alternatively you can try to switch to G1 garbage collector using -XX:+UseG1GC.

    Note that if you use any option which was removed in Java 8, you will see a warning upon application start:

    $ java -XX:MaxPermSize=128M -version
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
    java version "1.8.0_25"
    Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
    

提交回复
热议问题