JProfiler shos me 5M char[] instances take 2.5GB. The text itself in those char[] is a total of 1.2GB from a file. The 1.3GB seems overhead from the array instances, their fields like length, any alignment that the JVM might do. But still looks like too much? On the higher level what I keep in memory is a HashMap. JProfiler shows me that:
5M char[]: 2.5GB
5M String: 126MB
2.6M HashMap$Node: 84MB
Please advise, why would the JVM take so much heap overhead for the char[] instances, or perhaps the JProfiler can't do such an accurate reporting on the heap consumption by instances of each class?