Delphi XE3 EXE file size 25 times larger than Dephi 7

后端 未结 4 1073
面向向阳花
面向向阳花 2020-12-24 15:00

As a test I decided to create a simple \"Hello world\" app in Delphi using Delphi 4, 5, 6, 7, 2005, 2010 and XE3. The app is nothing more than a TForm, a TButton with an On

相关标签:
4条回答
  • 2020-12-24 15:34

    Just put these lines in your .dpr file, it reduces exe size by 20%

    uses Windows,

    {$O+} {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}

    0 讨论(0)
  • 2020-12-24 15:37

    Well .. there are many things that explain the difference between the old delphi release and the new .. the important thing is the support of unicode (D2009 .. DXE4),all chars in unicode alloc 2 bytes (in D1,D2,D3,D7,...they only alloc one byte)

    0 讨论(0)
  • 2020-12-24 15:40

    I figured out the problem. Chalk this up to the fact that I use Delphi 7 99% of the time when I develop, and XE3 is new to me. Even though I had chosen "Release" under the project options and made my tweaks there, it turns out that simply choosing "Release" there does not put the project into Release mode.

    This isn't enough

    Who would have thought that I also had to use the Project Manager panel and double click on the "Release" item in order to put the project into Release mode?

    Solution

    If anyone is curious, the final EXE is now 2,229 KB, which is only 5 times the size of the EXEs prior to Delphi 2010.

    0 讨论(0)
  • 2020-12-24 15:51

    You may have done a only a compile after changing to 'Release' configuration. Try to do a rebuild (not recompile). This will truly activate the Release configuration on the executable, and perhaps a smaller file size.

    For me (Delphi XE2), the size reported by Windows for the same app (Release configuration) is:

    1.52 MB (1,600,512 bytes)

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