title: string.replace vs StringBuilder.replace for memory
body: <p>I have downloaded a stream as a byte[] 'raw' that is about 36MB.  I then convert that into a string with</p>
  
  <pre><code>string temp = System.Text.Encoding.UTF8.GetString(raw)
  </code></pre>
  
  <p>Then I need to replace all "\n" with "\r\n" so I tried</p>
  
  <pre><code> string temp2 = temp.Replace("\n","\r\n")
  </code></pre>
  
  <p>but it threw an "Out of Memory" exception.  I then tried to create a new string with a StringBuilder:</p>
  
  <pre><code>string temp2 = new StringBuilder(temp).Replace("\n","\r\n").toString()
  </code></pre>
  
  <p>and it didn't throw the exception.  Why would there be a memory issue in the first place (I'm only dealing with 36MB here), but also why does StringBuilder.Replace() work when the other doesn't?</p>