title: Fixed size LinkedHashMap memory leak?
body: <p>I'm trying to use LinkedHashMap as a local FIFO cache solution overwriting its removeEldestEntry method to keep size fixed:</p>
  
  <pre><code>Map lhm = new LinkedHashMap(MAX_CACHE_SIZE + 1, .75F, false) {
     protected boolean removeEldestEntry(Map.Entry eldest) {
        return size() &gt; MAX_CACHE_SIZE;
     }
  };
  </code></pre>
  
  <p>but when I constantly add new entries to the map monitoring process memory I see it keeps growing until max virtual machine memory is used though map size doesn't increase.</p>
  
  <p>Is it by design? Why does it need more memory if old values are discarded and size of the map is limited?</p>
  
  <p>UPDATE:
  as requested I'm attaching full code: </p>
  
  <pre><code>@Test
  public void mapMemory() {
      final int MAX_CACHE_SIZE = (int) 1E3;
      Map lhm = new LinkedHashMap(MAX_CACHE_SIZE + 1, 1F, false) {
         protected boolean removeEldestEntry(Map.Entry eldest) {
            return size() &gt; MAX_CACHE_SIZE;
         }
      };
  
      for (long i = 0; i &lt; 1E10; i++) {
          lhm.put("key_" + i, "VALUE");
      }
  }
  </code></pre>