fpc/tests/webtbs/tw18690.pp
Jonas Maebe 7cb1c8b586 * improvement of r16001 so that allocations even closer to high(ptruint)
also fail correctly rather than overflowing to 0 bytes (mantis #18690)

git-svn-id: trunk@16877 -
2011-02-04 18:58:21 +00:00

18 lines
378 B
ObjectPascal

Procedure AllocFreeGiB;
var
p: pointer;
RequestedSize: ptruint;
Begin
Writeln('-----------------------------');
RequestedSize:=high(ptruint); // n GiB - 1
Writeln('RequestedSize = ',RequestedSize,' bytes');
getmem(p,RequestedSize);
if (p<>nil) then
halt(1);
End;
Begin
ReturnNilIfGrowHeapFails:=true;
AllocFreeGiB;
End.