summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/amunits/examples/checkmem.pas
blob: 0656183657d0f62451b5e21b048cff6a0270bb20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
program checkmem;

uses exec, amigados;

var
  chipfirst,
  chipsecond,
  fastfirst,
  fastsecond : longint;

begin

  if ParamCount <> 1 then begin
     writeln('Usage: CheckMem ProgramName');
     halt(10);
  end;

  chipfirst := AvailMem(MEMF_CHIP);
  fastfirst := AvailMem(MEMF_FAST);


  if Execute(ParamStr(1),0,0) then begin
     chipsecond := AvailMem(MEMF_CHIP);
     fastsecond := AvailMem(MEMF_FAST);

     writeln('Memory loss (Chip): ',chipsecond-chipfirst);
     writeln('Memory loss (Fast): ',fastsecond-fastfirst);
     halt;
  end else writeln('Could''t run the program');
end.