java 将 JVM 堆大小设置为至少 8GB
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34742192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
set JVM heap size to be atleast 8GB
提问by user1870400
I want to set the JVM heap size to be atleast 8GB. Can I do that with below configuration? I see that the max heap size is 4GB from the command below and I am not sure how to set it to 8GB?
我想将 JVM 堆大小设置为至少 8GB。我可以使用以下配置来做到这一点吗?我从下面的命令中看到最大堆大小为 4GB,但我不确定如何将其设置为 8GB?
java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
intx CompilerThreadStackSize = 0 {pd product}
uintx ErgoHeapSizeLimit = 0 {product}
uintx HeapSizePerGCThread = 87241520 {product}
uintx InitialHeapSize := 264241152 {product}
uintx LargePageHeapSizeThreshold = 134217728 {product}
uintx MaxHeapSize := 4206886912 {product}
intx ThreadStackSize = 1024 {pd product}
intx VMThreadStackSize = 1024 {pd product}
回答by Peter Lawrey
To set the minimum heap size use -Xms
e.g. -Xms8g
设置最小堆大小使用-Xms
例如-Xms8g
To set the maximum heap size use -Xmx
e.g. -Xmx16g
设置最大堆大小使用-Xmx
例如-Xmx16g
Of course this only controls the heap and doesn't control any of the other memory regions such as stacks for thread, code storage, shared libraries, direct memory, GUI component etc.
当然,这只控制堆,不控制任何其他内存区域,例如线程堆栈、代码存储、共享库、直接内存、GUI 组件等。