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

前端 未结 15 1810
野趣味
野趣味 2020-11-30 07:36

I release a single executable (.EXE) for a desktop program using Delphi 2009. I have no external DLLs or resources that I need for the program to run.

I use two comp

相关标签:
15条回答
  • 2020-11-30 08:09

    It has been stated earlier that using an executable compresser reduces the size of the exe but not of the install package. However, if you want a good compressor then try ASPack.

    @Tom1952: ASPack is pretty fast, just a few seconds to compress a file

    0 讨论(0)
  • 2020-11-30 08:10

    Also you can change the Icon. Icon in newest delphi IDE (ie XE3) is Vista/7 compatible and contains all sizes (up to 256x256 as far as I know). So you can reduce exe file size with changing the Icon.

    0 讨论(0)
  • 2020-11-30 08:10

    Uncheck debug information in project options. If embarcadero can't provide any solution or explanation!!! I think the solution is simple: don't stuck only with Delphi there is a lot of programming languages, every one is limited only by programmer imagination.

    0 讨论(0)
  • 2020-11-30 08:12

    Since D2010 adds extended RTTI, and RTTI is a notorious factor in increasing exe size, it would be interesting to see how big D2009 binaries are for that application.

    If D2009 binaries are significantly smaller, it is not Unicode etc. For my own binaries, I only have a 30% increase or so going from D7 to D2009.

    0 讨论(0)
  • 2020-11-30 08:20

    I will add my few words. Linker can remove unused procedures and functions only if it can follow the code hierarchy. The nightmare list for linker listed below:

    • Message-driven code, the sad news is that this code can't be removed whatsoever, that's why Delphi blank project size continues growing from version to version. Every new windows message (WM_TOUCH for example as long as I know introduced recently) creates procedure call hierarchy that can't be removed (even if you don't have plan to use Touch API at all). This is because every case WM_: fragment is something linker can't decide whether it will be used or not.

    • Code and data structures accessed from the begin end, initialization, finalization secions of the units. Here you have some control, remove unnecessary calls or object creation. Even if you create objects on demand and only free them in finalization section, make it carefully

    0 讨论(0)
  • 2020-11-30 08:21

    The standard units in you newer delphi may contain more strings and constants such as error strings, that is included even if you disable debug information. Check your uses.

    Don't have much of a somution besides not using a specific unit, or removing unneeded data from it.

    (My experiences are with Delphi 5)

    0 讨论(0)
提交回复
热议问题