FreeAndNil

From Free Pascal wiki
Revision as of 10:38, 19 August 2016 by FPC user (talk | contribs) (Creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

FreeAndNil is a procedure defined in the SysUtils unit of the Free Pascal Runtime Library. It calls an object's constructor (via TObject.Free) and also sets the object variable (which is a reference to heap memory created by a constructor call) to nil. If you just call an object's destructor, Assigned will still return True for the object variable. But after calling FreeAndNil, Assigned will return False for the object variable

procedure FreeAndNil( var obj );