XX:MaxDirectMemorySize 的默认值

XX:MaxDirectMemorySize 的默认值是什么?


答案 1

sun.misc.VM 开始,它是 Runtime.getRuntime.maxMemory(),这就是 用 .例如,如果您进行配置和配置,则“默认值”也将为 5 Gb,并且应用的总堆 + 直接内存使用量可能会增长到 5 + 5 = 10 Gb。-Xmx-XX:MaxDirectMemorySize-Xmx5gMaxDirectMemorySize


答案 2

http://www.docjar.com/html/api/sun/misc/VM.java.html

明白了:

 163       // A user-settable upper limit on the maximum amount of allocatable direct
 164       // buffer memory.  This value may be changed during VM initialization if
 165       // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
 166       //
 167       // The initial value of this field is arbitrary; during JRE initialization
 168       // it will be reset to the value specified on the command line, if any,
 169       // otherwise to Runtime.getRuntime.maxDirectMemory().
 170       //
 171       private static long directMemory = 64 * 1024 * 1024;

所以它似乎默认为64兆。