首页 > 系统相关 > 获取程序内存信息

获取程序内存信息

时间:2023-01-07 20:56:38浏览次数:33  
标签:Runtime 程序 获取 内存 put runtime data

/**
* 获取程序内存信息
*
* @param
* @return
*/
@org.junit.Test
public void MemoryAction (){
Runtime runtime = Runtime.getRuntime();
// 获取Runtime对象实例
Map<String, Object> data = new HashMap<>();
// 创建Map集合
data.put("MaxMemorty", runtime.maxMemory());
// 数据存储
data.put("TotalMemory", runtime.totalMemory());
// 数据存储
data.put("FreeMemory", runtime.freeMemory());
// 数据存储
System.out.println(data);
}

{TotalMemory=255852544, MaxMemorty=3801088000, FreeMemory=246441848}

 

 

 

标签:Runtime,程序,获取,内存,put,runtime,data
From: https://www.cnblogs.com/cnetsa/p/17033522.html

相关文章