zoukankan      html  css  js  c++  java
  • Map占用内存大小评估

    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));
    }
    }
  • 相关阅读:
    Rocket
    Rocket
    Rocket
    Rocket
    Rocket
    Rocket
    UVa 10534 DP LIS Wavio Sequence
    LA 4256 DP Salesmen
    HDU 2476 区间DP String painter
    HDU 4283 区间DP You Are the One
  • 原文地址:https://www.cnblogs.com/mu-tou-man/p/7715057.html
Copyright © 2011-2022 走看看