ex40.pp 493 B

12345678910111213141516171819202122
  1. Program Example40;
  2. { Program to demonstrate the MaxAvail function. }
  3. Var
  4. P : Pointer;
  5. I : longint;
  6. begin
  7. { This will allocate memory until there is no more memory}
  8. I:=0;
  9. While MaxAvail>=1000 do
  10. begin
  11. Inc (I);
  12. GetMem (P,1000);
  13. end;
  14. { Default 4MB heap is allocated, so 4000 blocks
  15. should be allocated.
  16. When compiled with the -Ch10000 switch, the program
  17. will be able to allocate 10 block }
  18. Writeln ('Allocated ',i,' blocks of 1000 bytes');
  19. end.