title: Encourage the JVM to GC rather than grow the heap?
body: <p>(Note that when I say "JVM", I really mean "Hotspot", and I'm running the latest Java 1.6 update.)</p>
  
  <p>Example situation:</p>
  
  <p>My JVM is running with -Xmx set to 1gb.  Currently, the heap has 500mb allocated, of which 450mb is used.  The program needs to load another 200 mb on the heap.  Currently, there is 300mb worth of "collectable" garbage in the heap (we'll assume it's all in the oldest generation.)</p>
  
  <p>Under normal operation, the JVM will grow the heap to 700 mb or so, and garbage collect when it gets around to it.</p>
  
  <p>What I would like in that situation is for the JVM to gc first, then allocate the new stuff, so that we end up with the heap size staying at 500mb, and the used heap at 350mb.</p>
  
  <p>Is there a JVM parameter combo that does that?</p>