[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

FreeAndNil

Free object if needed, and set object reference to Nil

Declaration

Source position: sysutilh.inc line 235

procedure FreeAndNil(

  var obj

);

Description

FreeAndNilwill free the object in Objand will set the reference in Objto Nil. The reference is set to Nilfirst, so if an exception occurs in the destructor of the object, the reference will be Nilanyway.

Errors

Exceptions that occur during the destruction of Objare not caught.