Free Function

Action

Releases memory that was allocated with Malloc.

Include file

Kernel.bdh

Syntax

Free( in hMem : number );
Parameter Description
hMem Pointer to allocated memory

Example

dcltrans
  transaction TFree
  var
    nBuffer: number;
  begin
    // allocate a buffer of 10 bytes
    nBuffer := Malloc(10);
    write("memory successfully allocated"); writeln;

    // free memory referenced by nBuffer
    Free(nBuffer);
    write("memory released"); writeln;
  end TFree;

Output

memory successfully allocated
memory released