Forum > Windows

How to reduce EXE program size?

(1/12) > >>

FlierMate:
My simple "Hello World" program is 49,815 bytes. Hmm..., can we strip it of unused libraries / data?

The attached picture shows the code section of that size, in which I think the rest of EXE are unrelated to displaying "Hello World" text string on console screen?

I thought I want to attempt writing a compress tool for FPC but (1) the output EXE is far more complicated that I thought, (2) it is best if it is done by the developer of the FPC itself (i.e. not outsider like me).  :D

Thank you for your attention.

winni:
Hi!

Assuming you got only 4GB Ram then your exe occupies 0.001 % of it.

Winni

marcov:
And Windows EXEs are not even always fully loaded into memory

Anyway, if you want to obsess over size, you'll need to do it yourself. In the past research by people focussed on size has occasionally been merged back as improvement.

But most suggestions are microoptimizations that limit features. Fixes should be real saving of size (e.g. linker improvements), not just cutting the featureset to minimal. If you want that, you'll need to manage it yourself (e.g. maintain your own cut down RTL), since one RTL will never serve all users size requirements optimally

So the short answer is: maintain a custom rtl is the easiest for special size requirements. Of course work on improving the smart linking is always welcome.

Gustavo 'Gus' Carreno:
Hey FlierMate,

Every once in a while, and lately more often than most(isn't this the 2nd post this last month), someone comes along with this notion that they need to produce a rather small binary.

In the current age where hardware minimums are in the 4GB for RAM and half a TERA for HDDs, I really don't understand this chasing of the windmills.

The only place where this should be brought up is in embedded environments, where you have very limited RAM/ROM/EPROM.

But even there, with the advent of the Arduino(AVR SoC) and the Raspberry Pie(ARM SoC) those limitations are getting smaller every iteration.

So, FlierMate, could you please explain to me this urgent quest to make the binary small? Please?

I profoundly thank you, in advance, for any light shed into this predicament.

Cheers,
Gus

Aidex:
Hi!
Have you tried the following?

Project Settings > Compiler Settings > Debugging > tick "Use external debug symbols file" (-Xg)

Navigation

[0] Message Index

[#] Next page

Go to full version