[fpc-pascal] Why win64 program are considerably bigger in exe size than win 32?

Martok listbox at martoks-place.de
Sun Dec 31 00:19:22 CET 2017

Am 22.12.2017 um 09:30 schrieb Dennis:
> I am upgrading my program from win 32 to win 64 using the new Lazarus 1.8.
> I discovered my program exe size increased from 6M to 9M.
Just for fun, I wrote a small program to parse Linker Map files and show the
image occupation by source object file (~unit).

First lesson: FPC's internal linker is *a lot* better than the GNU linker when
it comes to discarding unused parts. Good job there!
Second lesson: the RTL's system and classes are large, compared to Delphi (at
least older versions). They can do more as well, so I'll call that a draw.

And now the on-topic part: this compares an "empty" project (Lazarus:
Project->New->Program), compiled for win32 and win64
As you can see, the win64 image is about a third larger - but not so much
because of the code segments (they end shortly after the cyan "bar" for typinfo,
before the second occurrence of classes), but more so because of the data
sections following. A lot of that is unwind info (.xdata), I'm afraid I don't
know what .pdata usually is.

Oh, and I finally know why even simple LCL applications are so large: graphics
drags in fcl-image, which includes full support for JPEG, TIFF, PNG and requires
pasjpeg, paszlib and others. The widgetset indirection is surprisingly small.

Just though I'd share that.


Ceterum censeo b32079 esse sanandam.

More information about the fpc-pascal mailing list