title: Garbage collection on intern'd strings, String Pool, and perm-space
body: <p>After exploring java's string internals I've grown confused on what is referred to as the "perm space."  My understanding initially of it was that it held <code>String</code> <em>literals</em> as well as class meta data as explained in <a href="https://stackoverflow.com/questions/1279449/what-is-perm-space">this question</a>.</p>
  
  <p>I've also read about the <code>String.intern()</code> method and that it places <code>String</code>s into the String Pool returning a reference to unique instance of it.  It is my understanding that this is the same string pool holding String literals that exists in the JVM's perm-space.  It didn't seem possible to me that the "perm-space" could be modifiable, (it is permanent after all, yes?).  But Then I found <a href="https://stackoverflow.com/questions/2431540/garbage-collection-behaviour-for-string-intern">this question</a> where the top voted comment by EJP on the accepted answer explains that</p>
  
  <blockquote>
    <p>Intern'd strings have been GC-able for quite some years now.</p>
  </blockquote>
  
  <p>Implying that the GC runs on the perm-space which doesn't seem very permanent.  How does this reconcile?  Does the GC check everything in the perm-space?  Does the GC check everything in the string pool including string literals from the source?  Is there a second string pool for intern'd strings?  Does the GC know only to look over intern'd strings when collecting?  Or is this comment mistaken and intern'ing a string prevents it from ever being GC'd (which I hope is not the case)?</p>