title: Multimap Space Issue: Guava
body: <p>In my Java code, I am using Guava's Multimap (<a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Multimap.html" rel="noreferrer">com.google.common.collect.Multimap</a>) by using this:</p>
  
  <pre><code> Multimap&lt;Integer, Integer&gt; Index = HashMultimap.create()
  </code></pre>
  
  <p>Here, Multimap key is some portion of a URL and value is another portion of the URL (converted into an 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 <code>int</code>) it should store more.</p>
  
  <p>Can anybody help me,</p>
  
  <ol>
  <li>Why is <code>Multimap</code> using lots of memory?  I checked my code and without inserting pairs into the <code>Multimap</code>, it only uses 1/2 MB of memory.</li>
   2. 
  </ol>
  
  <p><strong>Is there another way or home-baked solution to solve this memory issue?</strong> Means, Is there any way to reduce those object overheads as I want to store only int-int? In any other language ? Or any other solution (home-baked preferred) to solve issue I faced, means DB based or something like that solution.</p>