Как получить минуту и макс. настройки размера "кучи" VM из программы Java?
максимальный размер кучи:
Runtime.getRuntime().maxMemory();
Некоторые другие расчеты, которые могут показаться вам интересными:
Runtime runtime = Runtime.getRuntime();
long maxMemory = runtime.maxMemory();
long allocatedMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();
long totalFreeMemory = freeMemory + (maxMemory - allocatedMemory);
long usedMemory = maxMemory - totalFreeMemory;
Вам просто нужно использовать объект Runtime с помощью Runtime.getRuntime (), а затем используйте такие методы, как totalMemory () freeMemory ()
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html #freeMemory ()
может быть, это может вам помочь?
http://download.oracle.com/docs/cd/E11035_01/wls100/perform/JVMTuning.html#wp1109778 http://javahowto.blogspot.com/ 2006/06/6-common-errors-in-setting-java-heap.html http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp http: // blog.paulgu.com/2008/07/19/6-common-errors-in-setting-java-heap-size/