What are the -Xms and -Xmx parameters when starting JVM?

前端 未结 5 868
悲哀的现实
悲哀的现实 2020-11-21 06:44

Please explain the use of Xms and Xmx parameters in JVMs. What are the default values for them?

5条回答
  •  耶瑟儿~
    2020-11-21 07:05

    Run the command java -X and you will get a list of all -X options:

    C:\Users\Admin>java -X
    -Xmixed           mixed mode execution (default)
    -Xint             interpreted mode execution only
    -Xbootclasspath:
                          set search path for bootstrap classes and resources
    -Xbootclasspath/a:
                          append to end of bootstrap class path
    -Xbootclasspath/p:
                          prepend in front of bootstrap class path
    -Xdiag            show additional diagnostic messages
    -Xnoclassgc       disable class garbage collection
    -Xincgc           enable incremental garbage collection
    -Xloggc:    log GC status to a file with time stamps
    -Xbatch           disable background compilation
    -Xms        set initial Java heap size.........................
    -Xmx        set maximum Java heap size.........................
    -Xss        set java thread stack size
    -Xprof            output cpu profiling data
    -Xfuture          enable strictest checks, anticipating future default
    -Xrs              reduce use of OS signals by Java/VM (see documentation)
    -Xcheck:jni       perform additional checks for JNI functions
    -Xshare:off       do not attempt to use shared class data
    -Xshare:auto      use shared class data if possible (default)
    -Xshare:on        require using shared class data, otherwise fail.
    -XshowSettings    show all settings and continue
    -XshowSettings:all         show all settings and continue
    -XshowSettings:vm          show all vm related settings and continue
    -XshowSettings:properties  show all property settings and continue
    -XshowSettings:locale      show all locale related settings and continue
    

    The -X options are non-standard and subject to change without notice.

    I hope this will help you understand Xms, Xmx as well as many other things that matters the most. :)

提交回复
热议问题