title: How to free, or recycle, a string in C#?
body: <p>i have a large string (e.g. 20MB).</p>
  
  <p>i am now parsing this string. The problem is that strings in C# are immutable; this means that once i've created a substring, and looked at it, the memory is wasted.</p>
  
  <p>Because of all the processing, memory is getting clogged up with <code>String</code> objects that i no longer used, need or reference; but it takes the garbage collector too long to free them.</p>
  
  <p>So the application runs out of memory.</p>
  
  <p>i could use the poorly performing <em>club</em> approach, and sprinkle a few thousand calls to:</p>
  
  <pre><code>GC.Collect();
  </code></pre>
  
  <p>everywhere, but that's not really solving the issue.</p>
  
  <p>i know <code>StringBuilder</code> exists when <em>creating</em> a large string.  </p>
  
  <p>i know <code>TextReader</code> exists to read a <code>String</code> into a <code>char</code> array.</p>
  
  <p>i need to somehow "<em>reuse</em>" a string, making it no longer immutable, so that i don't needlessly allocate gigabytes of memory when 1k will do.</p>