java Java MaxMemory
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java Java MaxMemory相关的知识,希望对你有一定的参考价值。
// See my answer to Stack Overflow: Maximum java heap size of a 32-bit JVM on a 64-bit host
// http://stackoverflow.com/questions/1434779/maximum-java-heap-size-of-a-32-bit-jvm-on-a-64-bit-os/7019624#7019624
// and my blog: http://milosophical.me/blog/2007/03/04/32-bit-windows-and-jvm-virtual-memory-limit.html
public class MaxMemory {
public static void main(String[] args) {
Runtime rt = Runtime.getRuntime();
long totalMem = rt.totalMemory();
long maxMem = rt.maxMemory();
long freeMem = rt.freeMemory();
double megs = 1048576.0;
System.out.println ("Total Memory: " + totalMem + " (" + (totalMem/megs) + " MiB)");
System.out.println ("Max Memory: " + maxMem + " (" + (maxMem/megs) + " MiB)");
System.out.println ("Free Memory: " + freeMem + " (" + (freeMem/megs) + " MiB)");
}
}
以上是关于java Java MaxMemory的主要内容,如果未能解决你的问题,请参考以下文章
JAVA虚拟机内存不够解决办法
47 VM.maxDirectMemory() 来自于哪里
47 VM.maxDirectMemory() 来自于哪里
Java之RunTime
从java获取操作系统内存大小
redis的maxmemory与maxmemory-policy关系