Custom HashMap Code Issue

后端 未结 3 1455
醉话见心
醉话见心 2020-12-12 01:39

I have following code, where I used HashMap (using two parallel arrays) for storing key-value pairs (key can have multiple values). Now, I have to store and load it for futu

3条回答
  •  臣服心动
    2020-12-12 02:26

    I doubt this is possible, given the datatypes you have declared. Just multiply the sizes of the primitive types.

    Each row requires 4 bytes to store an int and 8 bytes to store a long. 600 million rows * 12 bytes per row = 7200 MB = 7.03 GB. You say you can allocate 5 GB to the JVM. So even if it was all heap and stored only this custom HashMap, it will not fit. Consider shrinking the size of the datatypes involved or storing it somewhere other than RAM.

提交回复
热议问题