What is the default value for XX:MaxDirectMemorySize?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
For JDK8:
The 64MB are set arbitrarily initially, ...
(From: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/sun/misc/VM.java#L186 )
... but then the directMemory is set to maxMemory() ~= Heapsize here (if the maxDirectMemorySize-Parameter is not set):
(from: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/sun/misc/VM.java#L286 )
The test seems to support this claim, "test.java.nio.Buffer.LimitDirectMemory.java":
(from https://github.com/frohoff/jdk8u-dev-jdk/blob/da0da73ab82ed714dc5be94acd2f0d00fbdfe2e9/test/java/nio/Buffer/LimitDirectMemory.java#L74)
From http://www.docjar.com/html/api/sun/misc/VM.java.html
i see:
so it appears to default to 64 megs.
From
sun.misc.VM
, it'sRuntime.getRuntime.maxMemory()
, that's what is configured with-Xmx
. E. g. if you don't configure-XX:MaxDirectMemorySize
and do configure-Xmx5g
, the "default"MaxDirectMemorySize
will also be 5 Gb, and the total heap+direct memory usage of the app may grow up to 5 + 5 = 10 Gb.