title: Guava cache memory leak
body: <p>I am using guava library 14.0.1 to implement caching service (a web application containing a servlet to put and get values). The web application is deployed on a machine containing 1GB RAM (google backend). The number of write and read operations is huge (50 queries per second). </p>
  
  <p>The amount of RAM used on the machine keeps on increasing even after hitting the maximumSize limit. I suspect memory leak.</p>
  
  <p>Following is the code I am using to create cache</p>
  
  <pre><code>Cache cache = CacheBuilder.newBuilder()
                  .expireAfterWrite(1, TimeUnit.DAYS)
                  .initialCapacity(2000000)
                  .maximumSize(3800000)
                  .concurrencyLevel(50)
                  .recordStats()
                  .build();
  </code></pre>
  
  <p>Retrieving the values using</p>
  
  <pre><code>Map result = cache.getAllPresent(keys);
  </code></pre>
  
  <p>Putting values in the cache using</p>
  
  <pre><code>cache.put(key, value);
  </code></pre>
  
  <p>Is there anything setting that I can use to stop increase in RAM usage beyond the limit.</p>