DelphiFAQ Home Search:

How to minimize the code (EXE size)


commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Do anyone could inform me how to minimize the code?
Maybe, really removing debug information?

The only options that makes the Delphi linker include debug information into the finished executable is the option to include TD32 Debug Info.
In Delphi 5 this is under menu item Project | Options on tab 'Linker' in the field 'EXE and DLL options'. Below is a little example program. The size of the output file RegistryDel.exe was..

  • 60 kB linked without TD32 debug info
  • 970 kB linked including TD32 debug info

program RegistryDel;

  Windows, Registry;

{$R *.RES}

  s : string;
  with TRegistry.Create do
    s := ParamStr(1);
    if s='' then
      s := '\Software\Microsoft\MediaPlayer\Player\RecentURLList';
    DeleteKey (s);
You don't like the formatting? Check out SourceCoder then!
Content-type: text/html


2006-01-02, 16:55:49
black from Turkey  
1- You can use an exe compressor (like UPX) to decrease the size of the executable. You do not need to decompress the compressed file before running.

2- Project|Options then Packages tab. Check 'Build with runtime packages'. Build your application. Then, Project|Information for <application_name>. On the right of shown window you will see a list box placed in a group box. Do not forget to deploy those bpl files with your application. Borland packages much much more than this. For more information please read 'Deploying Applications' and 'Deploying Packages' topics in Delphi Help.
2015-02-01, 04:35:47
This is both street smart and intlgeilent.



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: