简体   繁体   English

Runtime.totalMemory()从64位jvm中配置的-Xmx值给出了一个错误的值

[英]Runtime.totalMemory() gives me a wrong value from configured -Xmx value in 64 bit jvm

Configured -Xmx is 2037m (-Xmx2037), when getting total memory from 配置-Xmx为2037m(-Xmx2037),从中获取总内存
Runtime.totalMemory() it gives 136mb, How can i get exact configured xmx value? Runtime.totalMemory()它给出136mb,我怎样才能得到精确配置的xmx值?

使用Runtime.maxMemoryRuntime.totalMemory返回当前堆大小。

totalMemory reports the current heap size, which grows only as needed towards the Xmx limit. totalMemory报告当前堆大小,该大小仅在需要时Xmx限制。 maxMemory reports the maximum heap size. maxMemory报告最大堆大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java:调用Runtime.freeMemory(),Runtime.totalMemory()和Runtime.maxMemory()的代价 - Java: on the cost of calling Runtime.freeMemory(), Runtime.totalMemory() and Runtime.maxMemory() C#相当于Java的Runtime.freeMemory()、Runtime.totalMemory()、Runtime.maxMemory() - C# equivalent to Java's Runtime.freeMemory(), Runtime.totalMemory(), Runtime.maxMemory() 云数据流 - 增加JVM Xmx值 - Cloud Dataflow - Increase JVM Xmx Value 为什么JVM的Runtime max memory小于命令行-Xmx指定的值? - Why the JVM's Runtime max memory is smaller than the value specified in command line -Xmx? Java进程内存使用量远远超过Runtime.totalMemory等方法所说的 - Java process memory usage much more than what Runtime.totalMemory et al methods are telling 什么是64位JVM上对象的默认哈希值 - What's the default hash value of an object on 64 bit JVM 32位JVM和64位JVM之间的Integer.MAX_VALUE有区别吗? - Is there difference for Integer.MAX_VALUE between 32bit JVM and 64bit JVM? String.length()给我一个错误的值 - String.length() gives me a wrong value Linux,最高命令,为什么“数据”值和jvm -xmx参数不相等? - Linux, top command, why “data” value and jvm -xmx param not equal? 为什么64位JVM在达到xmx之前会丢失内存? - Why does 64 bit JVM throw Out Of Memory before xmx is reached?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM