Java获取heap信息heapSize, heapMaxSiz
public static void main(String[] args) {
long heapSize = Runtime.getRuntime().totalMemory();
System.out.println(readableFileSize(heapSize)); //245.5 MB
long heapMaxSize = Runtime.getRuntime().maxMemory();
System.out.println(readableFileSize(heapMaxSize)); //3.6 GB
long heapFreeSize = Runtime.getRuntime().freeMemory();
System.out.println(readableFileSize(heapFreeSize)); //239.1 MB
}
本文标题:Java获取heap信息heapSize, heapMaxSiz
本文链接:https://www.haomeiwen.com/subject/pflaqftx.html
网友评论