Runtime run = Runtime.getRuntime(); 

long max = run.maxMemory()/(1024*1024); 

long total = run.totalMemory()/(1024*1024); 

long free = run.freeMemory()/(1024*1024); 

long usable = max - total + free; 

System.out.println("最大内存 = " + max); 
System.out.println("已分配内存 = " + total); 
System.out.println("已分配内存中的剩余空间 = " + free); 
System.out.println("最大可用内存 = " + usable); 

相关文章:

  • 2021-11-29
  • 2022-01-23
  • 2021-12-02
  • 2021-12-19
  • 2021-07-18
猜你喜欢
  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
相关资源
相似解决方案