blob: 6a3fc7a8f3980dd0fe1afb0b3a065af9003785b0 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{ Source provided for Free Pascal Bug Report 2494 }
{ Submitted by "Alan Mead" on 2003-05-17 }
{ e-mail: cubrewer@yahoo.com }
uses
erroru;
type
matrix_element = array[1..1] of byte;
big_matrix = array[1..1000000,1..610] of matrix_element;
longarray = array[0..0] of real;
{var
a : big_matrix;}
var p:pointer;
l : ^longarray;
size, storage : ptruint;
i,j:longint;
done:boolean;
mem : sizeint;
begin
ReturnNilIfGrowHeapFails:=true;
domem(mem);
done := false;
size := 40000000;
repeat
size := size+(size div 10);
storage := size * sizeof(real);
if storage>2000000000{$ifdef CPU64}*2000000000{$endif CPU64} then
storage:=2000000000{$ifdef CPU64}*2000000000{$endif CPU64};
writeln('size=',size,' (storage=',storage,')');
getmem(l,storage);
if (l=nil) then
begin
done := true;
writeln('getmem() failed');
end
else
begin
writeln('getmem() was successful');
// freemem(l,storage);
end;
until (done);
domem(mem);
end.
|