Skip to content

Instantly share code, notes, and snippets.

@dimmaq
Last active December 29, 2015 23:59
Show Gist options
  • Save dimmaq/7746248 to your computer and use it in GitHub Desktop.
Save dimmaq/7746248 to your computer and use it in GitHub Desktop.
ok
program Project2;
{$APPTYPE CONSOLE}
uses System.SysUtils;
var L: string;
procedure Test(const A: string);
var S: string;
begin
S := A;
//S := S + S;
L := S + S;
Writeln(A + ' '); // <- RefCnt = 0
end;
begin
try
Test('X');
Test(L);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message, #13#10, E.StackTrace);
end;
Readln;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment