public class test {
private static java.util.HashMap<String, String> needQueryResProductList = new java.util.HashMap<String, String>();
public static void main(String[] args) throws Exception {

String userlabel="12345678998765432100";
long start = 0;
long end = 0;
// 先垃圾回收
System.gc();
start = Runtime.getRuntime().freeMemory();
HashMap map = new HashMap();
for (int i = 0; i < 360000; i++) {
map.put("1111,2222,3333"+String.valueOf(i), userlabel);
}
// 快要计算的时,再清理一次
System.gc();
end = Runtime.getRuntime().freeMemory();
System.out.println("一个HashMap对象占内存:" + (end - start));
}
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-09-28
  • 2022-12-23
  • 2021-11-03
  • 2021-10-24
相关资源
相似解决方案