title: JVM - Goes 100% CPU usage
body: <p>I have a Java program that at some point turns into 100% CPU usage and sleep state at the same time. The program is not multithreaded.</p>
  
  <p>Looking around, I think the most likely cause for that is a bug or some mismatch in the way I run the java interpreter with respect to garbage collection. I can only think that the 100% CPU usage is because of GC. I am allocating enough memory for the program to run using Xmx, and the program does not run even near the amount I allocate. The amount I allocate is also much less than the total memory available on the machine.</p>
  
  <p>I found this:</p>
  
  <p><a href="http://code.google.com/p/spymemcached/issues/detail?id=279" rel="nofollow noreferrer">http://code.google.com/p/spymemcached/issues/detail?id=279</a></p>
  
  <p>There were also some mentions of that on stackoverflow.com such as here:</p>
  
  <p><a href="https://stackoverflow.com/questions/9697754/cms-garbage-collector-when-does-it-run">CMS garbage collector - when does it run?</a></p>
  
  <p>Still, I couldn't find a solution. Is this a bug in the JVM, and if so, how would I fix it?</p>
  
  <p>EDIT:
  I added a paste of the jstack output here: <a href="http://pastebin.com/Au0V9FCN" rel="nofollow noreferrer">http://pastebin.com/Au0V9FCN</a></p>