title: Solr uses too much memory
body: <p>We have a Solr 3.4 instance running on Windows 2008 R2 with Oracle Java 6 Hotspot JDK that becomes unresponsive.  When we looked at the machine, we noticed that the available physical memory went to zero.  </p>
  
  <p>The Tomcat7.exe process was using ~70Gigs (Private Working Set) but Working Set (Memory) was using all the memory on the system.  There were no errors in the Tomcat / Solr logs.  We used VMMap to identify that the memory was being used for memory mapping the Solr segement files.</p>
  
  <p>Restarting Tomcat fixed the problem temporarily, but it eventually came back.</p>
  
  <p>We then tried decreasing the JVM size to give more space for the memory mapped files, but then the Solr eventually becomes unresponsive with the old generation at 100%.  Again resetting fixed the problem, but it did not throw an out-of-memory exception before we reset.</p>
  
  <p>Currently our spidey sense is telling us that the cache doesn't shrink when there is memory pressure, and that maybe there are too many MappedByteBuffers hanging around so that the OS can not free up the memory from memory mapped files.</p>