title: Huge memory consumption with Strings
body: <p>I'm collecting string data in a struct. In the end I'm writing that string to a file. The results are 4 files each 80 MB. But internaly it occupied nearly 16 GB (!) of RAM forces the OS to swap. (I'm using Swift 3.0)</p>
  
  <pre><code>struct ActionCMD {  // struct!
      var cmd = String()
  
  ...
  
      mutating func lines(_ text: String, toTheTop: Bool = false) {
          if toTheTop { cmd  = text + cmd }
          else        { cmd += text }
      }
  ...
  }
  </code></pre>
  
  <p>Any idea why this happens and how to avoid?</p>