title: CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled
body: <p>I've kind of asked this question before - <a href="https://stackoverflow.com/questions/3334911/what-does-jvm-flag-cmsclassunloadingenabled-actually-do">What does JVM flag CMSClassUnloadingEnabled actually do?</a>, but this time it's slightly different!</p>
  
  <p>If I start a Java VM with the <code>-XX:+CMSPermGenSweepingEnabled</code> flag set, the following message is printed:</p>
  
  <blockquote>
    <p>Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future</p>
  </blockquote>
  
  <p>The <code>-XX:+CMSPermGenSweepingEnabled</code> flag is often used to mitigate against <code>PermGen OutOfMemory</code> errors, however I have <a href="http://www.coderanch.com/t/461502/Performance/java/CMSClassUnloadingEnabled-vs-CMSPermGenSweepingEnabled#2060063" rel="noreferrer">read elsewhere</a> that people have found that by following the above advice they have still had these errors, but by sticking with <code>-XX:+CMSPermGenSweepingEnabled</code> as well as <code>-XX:+CMSClassUnloadingEnabled</code> their VM has stayed up longer between restarts.</p>
  
  <p>Does <code>-XX:+CMSClassUnloadingEnabled</code> really supersede <code>-XX:+CMSPermGenSweepingEnabled</code> or is there still some benefit in having them both?</p>
  
  <p>Thanks in advance</p>
  
  <p>Rich
  ps: I know that the root cause of perm gen issues is still usually Classloader leaks, this is more about the message that the JVM produces if we use the above options.</p>