コマンド -Xms500m -Xmx139000m を使用して 104 Gp ヒープ メモリを取得しています
コア i5 プロセッサ 64 ビット Windows 7 Os を使用しています。500 Gp ハードディスク。4GB RAMのみ
Jvmが104 GB(ヒープ)のメモリをどこから取得するのか知りたいだけですか?
出力にメモリ使用量が表示されませんか?
`public class CPUusage { public static void main(String[] args)throws Exception { int mb = 1024*1024; int GB = 1024*1024*1024; /* Total number of processors or cores available to the JVM */ System.out.println("Available processors (cores): " + Runtime.getRuntime().availableProcessors()); /* Total amount of free memory available to the JVM */ System.out.println("Free memory (MB): " + Runtime.getRuntime().freeMemory()/mb); /* This will return Long.MAX_VALUE if there is no preset limit */ long maxMemory = Runtime.getRuntime().maxMemory()/GB; /* Maximum amount of memory the JVM will attempt to use */ System.out.println("Maximum memory (GB): " + maxMemory); /* Total memory currently in use by the JVM */ System.out.println("Total memory (MB): " + Runtime.getRuntime().totalMemory()/mb); /* Get a list of all filesystem roots on this system */ File log=new File("D:\\log.txt"); log.createNewFile(); FileWriter fstream = new FileWriter(log); BufferedWriter out = new BufferedWriter(fstream); out.write("--------------------------------------------"+"\n\n"); out.write("Available processors (cores): " + Runtime.getRuntime().availableProcessors()); out.newLine(); out.write("Free memory (MB): " + Runtime.getRuntime().freeMemory()/mb); out.newLine(); out.write("Maximum memory (MB): " + (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory)); out.newLine(); out.write("Total memory (MB): " + Runtime.getRuntime().totalMemory()/mb); out.newLine(); File[] roots = log.listRoots(); /* For each filesystem root, print some info */ for (File root : roots) { System.out.println("-------------------------------------------"); System.out.println("File system root: " + root.getAbsolutePath()); System.out.println("Total space (GB): " + root.getTotalSpace()/GB); System.out.println("Free space (GB): " + root.getFreeSpace()/GB); System.out.println("Usable space (GB): " + root.getUsableSpace()/GB); out.write("-------------------------------------------"); out.newLine(); out.write("File system root: " + root.getAbsolutePath()); out.newLine(); out.write("Total space (GB): " + root.getTotalSpace()/GB); out.newLine(); out.write("Free space (GB): " + root.getFreeSpace()/GB); out.newLine(); out.write("Usable space (GB): " + root.getUsableSpace()/GB); out.newLine(); } out.write("-------------------------------------------"); out.newLine(); out.close(); } } `
そして、出力は
`Available processors (cores): 4 Free memory (MB): 476 Maximum memory (GB): 104 Total memory (MB): 479 ------------------------------------------- File system root: C:\ Total space (GB): 97 Free space (GB): 70 Usable space (GB): 70 ------------------------------------------- File system root: D:\ Total space (GB): 368 Free space (GB): 366 Usable space (GB): 366 `