[fpc-pascal] x64 compiler and Large Address Aware flag

OBones obones at free.fr
Wed Jul 27 09:32:05 CEST 2016


Hello,

We are using FPC (2.6.0) here to allow compiling our users ideas into 
runable code and while this has worked just fine until now, on one 
occasion we have reached a situation where the ppcrossx64 compiler ends 
with an EOutOfMemory exception.
Looking at its memory consumption, sure enough, it reaches 1.2G of RAM 
used and then dies with the exception.
If we rerun it with the same options, it then consumes 1G and finishes 
successfully with a valid DLL file.
The project we make it compile is made of 464 pas files, totaling 180M 
on the hard drive. Once compiled, the .o and .ppu files use 650M on the 
hard drive, while the DLL uses 124M.
Here is the command line we are using:

ppcrossx64 -Mdelphi -Fu..\units\x86_64-win64\fcl-base 
-Fu..\units\x86_64-win64\rtl -Fu..\units\precompiled1\x86_64-win64 
-Fu..\units\precompiled2\x86_64-win64 Project.dpr

I don't see any issue with the command line and the number of files does 
not seem that high to me.
As a workaround, I patched ppcrossx64.exe so that its PE header includes 
the Large Address Aware flag thus meaning it can now use up to about 3G 
of RAM instead of roughly 1.5
Once patched, I removed all .ppu and .o files and reran the same command 
line. This time it finished successfully at first run and observing it, 
it used 1.4 G of RAM at most during its execution.

I have used this flag in various projects for quite a while now and 
could not see any adverse effect, except in extreme corner cases where 
weird pointer arithmetic was used and more than 2G of RAM was in use.

Do you think it is safe to use the patched ppcrossx64 compiler?

Thanks a lot for your opinions.

Olivier



More information about the fpc-pascal mailing list