Multimap Space Issue: Guava

Posted by Arpssss on Stack Overflow See other posts from Stack Overflow or by Arpssss
Published on 2012-03-29T17:26:12Z Indexed on 2012/03/29 17:30 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

In my Java code, I am using Guavas Multimap (com.google.common.collect.Multimap) by using this:

Multimap< Integer, Integer> Index = HashMultimap.create()

Here, Multimap key is some portion of URL and value is another portion of URL (converted into integer). Now, I assign my JVM 2560 Mb (2.5 GB) heap space (by using Xmx and Xms). However, it can only store 9 millions of such (key,value) pairs of integers (approx 10 million). But, theoretically (according to memory occupied by int) it should store more.

Can anybody help me,

1) Why is this happening (means Multimap is taking lots of space) ? I checked my code with out inserting pairs in Multimap, it takes only 1/2 MB space.

2) Is there any other way or home-baked solution to solve this space issue ? More clearly, how to solve this memory issue ?

Thanks in advance and any idea is perfectly OK for me.

© Stack Overflow or respective owner

Related posts about java

Related posts about database