title: Setting -XX:+DisableExplicitGC in production: what could go wrong?
body: <p>we just had a meeting to address some performance issues in a web application that is used to calculate insurance  rates. The calculations are implemented in a C/C++-module, that is used in other software packages as well. To make it available as a webservice, a Java wrapper was implemented that exposes an XML based interface and calls the C/C++-module via JNI.</p>
  
  <p>Measurements showed that several seconds were spent on each calculation inside the Java part. So my first recomodation was to enable garbage collection logging in the VM. We could see at once that many stop-the-world full GCs were made. Talking about that, the developper of the java part told us they did a <code>System.gc()</code> on several occasions "to make sure the memory is released after use".</p>
  
  <p>OK, I won't elaborate on that statement any further... ;-)</p>
  
  <p>We then added abovementioned <code>-XX:+DisableExplicitGC</code> too the VMs arguments and reran the tests. This gained about 5 seconds per calculation.</p>
  
  <p>Since we cannot change the code by stripping all those <code>System.gc()</code> calls at this point in our release process, we are thinking about adding <code>-XX:+DisableExplicitGC</code> in production until a new Jar can be created.</p>
  
  <p>Now the question is: could there be any risk in doing so? About the only thing I can think of is tomcat using <code>System.gc()</code> internally when redeploying, but that's just a guess. Are there any other hazards ahead?</p>