如何从JVM获取堆和permgen的最大大小? [英] How to get the max sizes of the heap and permgen from the JVM?
本文介绍了如何从JVM获取堆和permgen的最大大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图以编程方式找出调用我的程序的JVM的最大permgen和最大堆大小,而不是当前可用的大小。
<有没有办法做到这一点?
我熟悉Java Runtime对象中的方法,但不清楚它们真正提供的是什么。
或者,有没有办法向Eclipse询问为这两个分配了多少钱?
解决方案
试试这个:
MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
mem.getHeapMemoryUsage()。getUsed();
mem.getNonHeapMemoryUsage()。getUsed();
但它们只提供快照数据,而非累积值。
I am trying to find out programatically the max permgen and max heap size with which a the JVM for my program has been invoked, not what is currently available to them.
Is there a way to do that?
I am familiar with the methods in Java Runtime object, but its not clear what they really deliver.
Alternatively, is there a way to ask Eclipse how much was allocated for these two?
解决方案
Try this ones:
MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
mem.getHeapMemoryUsage().getUsed();
mem.getNonHeapMemoryUsage().getUsed();
But they only offer snapshot data, not a cummulated value.
这篇关于如何从JVM获取堆和permgen的最大大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文