Which arguments stand for what in JVM memory options?

前端 未结 4 1513
余生分开走
余生分开走 2020-12-07 18:18

There a lot of JVM arguments that affect the JVM\'s memory usage like -Xms, -Xmx, -Xns, -XX:MaxPermSize...

  • What do they do?
  • Are there any
4条回答
  •  暖寄归人
    2020-12-07 18:36

    There are hundreds of JVM options available. Basically they are classified into three types:

    1. Standard Options,
    2. Non-standard X options,
    3. Non-standard XX options,

    List of few standard options: [To see complete list execute the command "java" without any option]

     -client       to select the "client" VM
     -server       to select the "server" VM
     -cp 
     -classpath 
                   A ; separated list of directories, JAR archives,
                   and ZIP archives to search for class files.
     -D=
                   set a system property
     -version      print product version and exit
     -showversion  print product version and continue
     -X            print help on non-standard options`
    

    List of few non-standard X options: [To see complete list execute the command "java -X"]

    -Xincgc           enable incremental garbage collection
    -Xms        set initial Java heap size
    -Xmx        set maximum Java heap size
    -Xss        set java thread stack size
    -Xprof            output cpu profiling data
    -Xmixed           mixed mode execution (default)
    -Xint             interpreted mode execution only
    

    List of few non-standard XX options: [Complete list available here]

    -XX:InitialHeapSize=        set initial Java heap size. Same as -Xms.
    -XX:MaxHeapSize=            set maximum Java heap size. Same as -Xmx.
    -XX:+PrintFlagsFinal              prints all JVM options passed.
    -XX:+UnlockDiagnosticVMOptions    opens up lot more VM options.
    

    If you want to enhance your knowledge in JVM options, please refer this blog. The link is just part 1 out of 8. Find out and read other parts as well.

提交回复
热议问题