- 4.67.2.33. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.33. FreeMem procedure
4.67.2.33. FreeMem procedure
Targets: MS-DOS, OS/2, Win32
System Unit
Disposes of a dynamic variable of a given size.
Declaration:
procedure FreeMem(var P: Pointer; Size: Longint);
Remarks:
P points to any type variable that was previously assigned
either by calling GetMem
or by an assignment. FreeMem returns the allocated memory,
pointed to by P, back to heap. Size must match the size of
the variable that was allocated by
GetMem.
If P does not reference heap, a run time error occurs.
An error occurs if FreeMem is called to de-allocate
a variable with the wrong size. This is particularly useful while debugging.
References to P^ after a call to FreeMem
result in undefined data.
- 4.67.2.33. -