home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / source / docs / refex / ex28.pp < prev    next >
Encoding:
Text File  |  2000-01-01  |  560 b   |  22 lines

  1. Program Example28;
  2.  
  3. { Program to demonstrate the FreeMem and GetMem functions. }
  4.  
  5. Var P : Pointer;
  6.     MM : Longint;
  7.     
  8. begin
  9.   { Get memory for P }
  10.   MM:=MemAvail;
  11.   Writeln ('Memory available before GetMem : ',MemAvail);
  12.   GetMem (P,80);
  13.   MM:=MM-Memavail;
  14.   Write   ('Memory available after GetMem  : ',MemAvail);
  15.   Writeln (' or ',MM,' bytes less than before the call.');
  16.   { fill it with spaces }
  17.   FillChar (P^,80,' ');
  18.   { Free the memory again }                       
  19.   FreeMem (P,80);
  20.   Writeln ('Memory available after FreeMem : ',MemAvail);
  21. end.
  22.