What Can I Do To Reduce My Executable’s Size (Delphi)?

When moving from Delphi 7 to Delphi 2010., our .exe’s grew for example from 16 megs to 35 megs.

I asked a question similar to yours on the Embarcadero forum a few weeks ago. (link) In my OP, I listed a series of links on this subject that you might find helpful.

We tried using UPX to compress our .exe’s. Letting it work for hours significantly reduced our .exe, but we probably won’t use it in production for these reasons:

  1. We have quite a few .exe’s and don’t want to wait 1/2-day on each build. (It’s possible that we could find a non-brute force set of parameters to UPX that would reduce this…)

  2. Although the size of the .exe is reduced, our shippable was not, because our installer (not surprisingly) is unable squeeze much more compression out of the already compressed file… whereas it was able to reduce the original 16 meg .exe down to 8 megs.

  3. I’ve read some reports that at some time (rarely, but not never), UPX exe’s triggered various anti-virus programs to report the application contained a virus. (I don’t recall the date, site, or details of where I saw this, so it’s a bit unfair of me to report it here.) But, we are so adverse to taking a risk of that even possibility happening, that UPX is off the table…

The link on the Embarcadero forum also includes a link to another SO thread on this topic.

I continue to be surprised and disappointed at the code bloat we found when moving to Delphi 2010. As Nick notes, 2X for Unicode is quite excessive.

However, the bloat is a relatively minor trade-off when moving to D2010, because, IMO, D2010 is such a terrific upgrade in so many other ways. But, it does mean that we’ll probably have to move to shipping 2 CDs rather than one. I’m not looking forward to seeing the reaction to this from our organization…

Leave a Comment