[fpc-pascal] Maximum of memory which can be used by single program in 32 bit Windows

LacaK lacak at zoznam.sk
Thu May 19 11:44:03 CEST 2016


>
>> Wow I never heared about such option.
>> This are my results:
>> (compiled application is Win 32 bit)
>
> How large are the memory blocks that you try to allocate.

Hard to say.
This happens inside TXMLDocument class as content is reading from file 
in procedure ReadXMLFile.
May be that somewhere during processing occurs request for large block 
of data.
(when I look at Resource Monitor as amount of memory is allocated I see 
there jump in one moment . more than 500 MB at once)

>
>> it should be 2GB on 32bit and 4GB on 64bit Windows with
>> *IMAGE_FILE_LARGE_ADDRESS_AWARE*
>
> There is a difference between the total amount of memory you can 
> allocate, and the maximum size of a single block of memory that you 
> can allocate. The latter is much smaller than the former,

I tried allocate at once 1GB and it succed.

I did simple program:

var
   m: array[1..15] of pointer;
   i: integer;

begin
   for i:=1 to 15 do begin
     m[i] := getmem(1024*1024*200);
     fillbyte(m[i]^, 1024*1024*200, 0);
     writeln(i);
     readln;
   end;
   for i:=1 to 15 do begin
     freemem(m[i]);
   end;
end.

Which "confirms" limit 2GB, because it stops with run time error just 
before 2GB boundary.
With {$setpeflags $20} under Win64 it can bypass 2GB.

So it leads me to conclusion, that somewhere inside ReadXMLFile must be 
big request for memory block (may be for only short time), which 
overcomes limit 2GB.
May be some kind of copy (assign) class instance to another ?

-Laco.




More information about the fpc-pascal mailing list