title: How to calculate actual memory used by string variable?
body: <p>Strings in Delphi locating in dynamic memory.</p>
  
  <p>How to calculate actual memory (in bytes) used by <code>string</code> variable? </p>
  
  <p>I know the string must store some additional information, at least reference count and length, but how many bytes it uses except characters?</p>
  
  <pre><code>var
    S: string;
  </code></pre>
  
  <p><em>Delphi 2010, XE, XE2 used</em></p>