Javaでプロセスの合計ヒープメモリと使用済みヒープメモリを取得する方法は?
strong textint mb = 1024 * 1024;
Runtime instance = Runtime.getRuntime();
System.out.println("***** Heap utilization statistics [MB] *****\n");
System.out.println("Total Memory: " + instance.totalMemory() / mb);
String str = "9280";
Process pr = instance.exec("cmd /c jmap -heap "+str);
これは Windows ベースで、クロス プラットフォームに必要です。