Previous: Delete procedure To the Table of Content Next: Eof function

- 4.62.2.21 -
Standard Units
System Unit
System Unit Procedures and Functions

Dispose procedure

Targets: MS-DOS, OS/2, Win32


System Unit

Disposes of a dynamic variable.

Declaration:
  procedure Dispose(var P: Pointer [ , Destructor ]);
Remarks: P points to a typed variable that was previously assigned either by calling New or by an assignment. Dispose returns the allocated memory, pointed to by P, back to heap. If P does not reference heap, a run time error occurs. References to P^ after a call to Dispose results in undefined data.

Note that dynamic variables are not limited to 65,535 (64K) bytes.

Example:
type
  StrAry = Array[0..$200] of Char;
var
  StrPtr : ^StrAry;
begin
  New(StrPtr);
  if StrPtr = nil then 
    Halt(1);
  FillChar(StrPtr,$200,'0');
  Dispose(StrPtr);  // Release back to Heap
end.



Previous: Delete procedure To the Table of Content Next: Eof function
Delete procedure Table of Content Eof function

- 4.62.2.21 -