daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.concurrent.ConcurrentHashMap;
  4. import java.util.stream.IntStream;
  5.  
  6. public class Survey {
  7.  
  8.     public static void main(String[] args) {
  9.         ConcurrentHashMap<String, List<ConcurrentHashMap<String, Object>>> testMap = new ConcurrentHashMap<>();
  10.  
  11.         long start = 0;
  12.         long end = 0;
  13.         // 先垃圾回收
  14.         System.gc();
  15.         start = Runtime.getRuntime().freeMemory();
  16.         IntStream.range(0, 4000).forEach(i -> {
  17.             String topic = "market.eosusdt.kline.1min" + i;
  18.             ConcurrentHashMap<String, Object> data = new ConcurrentHashMap<>();
  19.             data.put("id", 1537325760);
  20.             data.put("open", 5.1214);
  21.             data.put("close", 5.1199);
  22.             data.put("low", 5.117);
  23.             data.put("high", 5.1223);
  24.             data.put("amount", 1947.6461);
  25.             data.put("vol", 9972.01690388);
  26.             data.put("count", 18);
  27.  
  28.             List<ConcurrentHashMap<String, Object>> datas = new ArrayList<>();
  29.  
  30.             IntStream.range(0, 2000).forEach(j -> datas.add(data));
  31.  
  32.             testMap.put(topic, datas);
  33.         });
  34.         // 快要计算的时,再清理一次
  35.         System.gc();
  36.         end = Runtime.getRuntime().freeMemory();
  37.         System.out.println("占内存:" + (end - start) / 1000.0 + "M");
  38.     }
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top