help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

Freemem

Release allocated memory

Declaration

Source position: line 0

procedure Freemem(

  p: pointer;

  Size: PtrInt

);

function Freemem(

  p: pointer

):PtrInt;

Description

Freemem releases the memory occupied by the pointer P, of size Count (in bytes), and returns it to the heap. P should point to the memory allocated to a dynamic variable.

Errors

An error will occur when P doesn't point to the heap.

See also

Getmem

  

Allocate new memory on the heap

New

  

Dynamically allocate memory for variable

Dispose

  

Free dynamically allocated memory

Example

Program Example28;

{ Program to demonstrate the FreeMem and GetMem functions. }

Var P : Pointer;
    MM : Longint;

begin
  { Get memory for P }
  GetMem (P,80);
  FillChar (P^,80,' ');
  FreeMem (P,80);
end.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505