Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tdelphi
Last active January 4, 2016 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdelphi/8609918 to your computer and use it in GitHub Desktop.
Save tdelphi/8609918 to your computer and use it in GitHub Desktop.
example of using freed objet in Delphi. Works without any errors in D6
program programThatUsesFreedObject;
{$APPTYPE CONSOLE}
uses
Classes,
SysUtils;
var
tmpSL: TStringList;
begin
try
tmpSL := TStringList.Create;
tmpSL.Free;
tmpSL.Delimiter := '?';
Writeln('we just used freed object without any consequences: '+tmpSL.Delimiter);
except
on E: Exception do
writeln(E.Message);
end;
Readln;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment