title: Delphi strings and reference counting
body: <p>Delphi uses reference counting with strings.</p>
  
  <p>Do this mean that there is only one memory allocation for '1234567890'
  and all a,b,c,d, e and f.s reference to it? </p>
  
  <pre><code> type  
     TFoo = class
      s: string;
     end;
  
    const 
      a = '1234567890';
      b = a;
      c : string = a;
  
    var
      d: string;
      e: string;
      f: TFoo;
  
    function GetStr1(const s: string): string;
    begin
     Result := s;
    end;
  
    function GetStr2(s: string): string;
    begin
     Result := s;
    end;
  
    begin
     d := GetStr1(b);
     e := GetStr2(c);
     f := TFoo.Create;
     f.s := a;
    end;
  </code></pre>