learning java Runtime 类 获取内存及处理器核数信息
var rt = Runtime.getRuntime(); System.out.println(rt.freeMemory()/(1024*1024)); System.out.println(rt.maxMemory()/(1024*1024)); System.out.println(rt.totalMemory()/(1024*1024)); System.out.println(rt.availableProcessors());
output:
190 3050 192 4