lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <>
Subject RamUsageCrawler
Date Tue, 04 Dec 2018 17:18:10 GMT
Hi, I'm using RamUsageCrawler to size some things, and I find it seems
to underestimate the size of Map (eg HashMap and ConcurrentHashMap).
This is using a Java 10 runtime, with code compiled to Java 8. I
looked at the implementation and it seems as if for JRE classes, when
JRE >= 9, we can no longer use reflection to size them accurately?
Instead the implementation estimates the map size by treating it as an
array of (keys and value) plus some constant header size. But this
seems to neglect the size of the HashMap$Node (in the case of HashMap
- I haven't looked at ConcurrentHashMap or TreeMap or anything). In my
case, I have a great many maps of a relatively small number of shared
keys and values, so the crawler seems to be wildly under-counting. I'm
comparing to sizes gleaned from heap dumps, eclipse mat, and OOM

I wonder if we can we improve on the estimates for Maps and other Collections?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message