Forum > Windows

How to reduce EXE program size?

<< < (14/16) > >>


--- Quote from: WackaMold on July 19, 2021, 10:12:01 pm ---UPX Exe-packer from shrinks the empty program after compiling+linking from 44,032 bytes to 19,968 ... and a demo GUI About program from 2,853,376 bytes to 826,880 (68% shrinkage).

--- End quote ---

UPX is known, the FPC distribution even used to use it, but it was removed because it caused more problems (read: antivirus problems) than it solved.

Sorry for necroposting, but, I guess, my post will be useful. I don't see, that anybody has mentioned obvious way to decrease EXE size - runtime packages. It's one of two biggest EXE size offenders. Second is RTTI. Real reason, why C++ programs are so small - they use C++ Runtime Redist. I.e. all that msvcrt.dll stuff. Problem with Pascal - is that all that stuff is always built-in into every EXE and DLL, it produces. But! Funny thing, but Delphi allows this too. And this mechanism is called "Runtime packages". Problem is - Delphi Redist isn't as well-known, as C++ Redist. Not many developers know about it and provide it with their applications. They usually prefer to provide bpls themselves and this kills whole advantage of using runtime packages. Because if they're would be installed system-wide, they would be shared between all apps.

For example for my app (total size, including plug-ins):
Built-in 32bit: 9.75Mb
Built-in 64bit: 15.00Mb
Runtime 32bit: 4.77Mb (-51%) + 6.00Mb runtime
Runtime 64bit: 7.16Mb (-53%) + 8.62Mb runtime

But size change per plug-in is more dramatic:
Built-in 32bit: ~375Kb
Built-in 64bit: ~610Kb
Runtime 32bit: ~75Kb (-80%)
Runtime 64bit: ~130Kb (-79%)

So, more plug-ins - bigger advantage.

Runtime packages are ok only on Windows, imagine what problems will have users on Unixes.


--- Quote from: Alextp on October 26, 2021, 11:33:36 am ---Runtime packages are ok only on Windows, imagine what problems will have users on Unixes.

--- End quote ---
I don't think so. Unixes also have something like It's just RTL, that is separated to DLL. We can do the same with .so libraries too. For example compile RTL into something like and distribute all this libraries as separate LazRTL package.

I am no sure but I think Linuxes are not good in handling shared libraries. Many Linux programs (GIMP, Blender3D, OpenShot, etc) I downloaded couldn't start just because library version issue. I learned from mistakes, always install the program from Software Center or correct repository, or use the version that match my Linux version.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version