tw14315b.pp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. { this test fails for x86_64-linux with r44578, reason not found yet }
  2. program Project1;
  3. {$mode objfpc}{$H+}
  4. uses
  5. Classes, SysUtils;
  6. function RandomRange(const low : longint;
  7. const high : longint) : longint;
  8. begin
  9. if (high < low) then
  10. result := high + random(low - high + 1)
  11. else
  12. Result := low + random(high - low + 1);
  13. end;
  14. procedure GetStats(out used: ptruint);
  15. var
  16. fpcHeapStatus : TFPCHeapStatus;
  17. begin
  18. fpcHeapStatus := GetFPCHeapStatus();
  19. used:=fpcHeapStatus.CurrHeapUsed;
  20. writeln(' heap status: cu=' +
  21. IntToStr(fpcHeapStatus.CurrHeapUsed) + ', cs=' +
  22. IntToStr(fpcHeapStatus.CurrHeapSize) + ', cf=' +
  23. IntToStr(fpcHeapStatus.CurrHeapFree) + ', mu=' +
  24. IntToStr(fpcHeapStatus.MaxHeapUsed) + ', ms=' +
  25. IntToStr(fpcHeapStatus.MaxHeapSize));
  26. end;
  27. var
  28. i : integer;
  29. a : array of byte;
  30. u1, u2: ptruint;
  31. begin
  32. randseed:=2327946243;
  33. writeln('randseed: ',randseed);
  34. GetStats(u1);
  35. for i := 0 to 50 do begin
  36. SetLength(a, RandomRange(1024,1024*1024*15));
  37. end;
  38. SetLength(a, 0);
  39. GetStats(u2);
  40. if u1<>u2 then
  41. halt(1);
  42. writeln('ok');
  43. end.