Map<String, String> map = newHashMap<>(); System.out.println("map init value is " + RamUsageEstimator.sizeOf(map)); for (int i = 0; i < 100; i++) { RandomStringUtils.randomAlphanumeric(100); map.put(RandomStringUtils.randomAlphanumeric(10), RandomStringUtils.randomAlphanumeric(10)); } System.out.println("map size 100, value is " + RamUsageEstimator.sizeOf(map)); System.out.println("map size 100, value is " + RamUsageEstimator.humanSizeOf(map));