[fpc-pascal]Issues regarding available memory
Alan Mead
cubrewer at yahoo.com
Sat May 17 15:39:09 CEST 2003
--- Alan Mead <cubrewer at yahoo.com> wrote:
> Are these globals documented somewhere (I've printed
> all four PDF manuals and I don't recall seeing these) or do I need
> to
> unpack the system unit source to browse them?
My mistake. I see that ReturnNilIfGrowHeapFails is described clearly
on Page 77 of the Programmer's manual. And I see that I've left off
the ending 's'. Now my program compiles.
However, it still doesn't have the behavior I expect (see below).
BTW, note also that even when using the same 1.0.6 version of FPC, I
get RTE 216 on Linux and 203 on Windows 2000.
-Alan
[amead at alan ian]$ ./dummy
Total heap available is 262128 bytes
Largest block available is 262128 bytes
size=44000000 (storage=352000000)
getmem() was successful
..[lots of periods] ..OK
size=48400000 (storage=387200000)
Runtime error 216 at 0x0804F2B9
0x0804F2B9
0x0804EE80
0x08052BDA
0x080480B0
[amead at alan ian]$ cat dummy.pas
program dummy;
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 : longint;
i,j:longint;
done:boolean;
begin
ReturnNilIfGrowHeapFails:=true;
writeln('Total heap available is ',MemAvail,' bytes');
writeln('Largest block available is ',MaxAvail,' bytes');
done := false;
size := 40000000;
repeat
size := round(size * 1.1);
storage := size * sizeof(real);
writeln('size=',size,' (storage=',storage,')');
getmem(l,storage);
if (l=nil) then
begin
done := true;
end
else
begin
writeln('getmem() was successful');
j := 0;
for i := 1 to size do
begin
inc(j);
if (j MOD 100000 = 0) then
begin
write('.');
j := 0;
end;
l^[i] := 1.0;
end;
writeln('OK');
freemem(l,storage);
end;
until (done);
end.
=====
A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. "
"But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it."
"This is my position, and I will not compromise."
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
More information about the fpc-pascal
mailing list