Difference between revisions of "Dispose"

From Free Pascal wiki
Jump to navigationJump to search
(English translation of German page)
 
m (Inserted page template)
 
Line 1: Line 1:
 +
{{dispose}}
 +
 
Back to [[Reserved words]].
 
Back to [[Reserved words]].
  

Latest revision as of 08:39, 13 February 2020

Deutsch (de) English (en)

Back to Reserved words.

The reserved word dispose belongs to object-oriented programming.

The reserved word dispose releases the memory by reducing the reference counter to the memory object by 1. If the reference counter of an object is 0, the memory object is released.

Example:

  var
   intI: ^ Integer;

 begin
   ...
   if assigned (intI) then ... // Checks whether an address has been assigned to intI
   ...
   new (intI);  // Assigns a valid address to intI
   ...
   dispose (intI);  // Releases the address
   ...