title: What Can I Do To Reduce My Executable's Size (Delphi)?
body: <p>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.</p>
  
  <p>I use two components: <a href="https://web.archive.org/web/20160920021729/http://www.lmdinnovative.com:80/products/lmdelpack/" rel="noreferrer">LMD Innovative's ELPack</a> and <a href="https://www.trichview.com/" rel="noreferrer">Sergey Tkachenko's TRichView</a> that are compiled into my executable.</p>
  
  <p>When I build my production version, using the "Release" build configuration, the executable file produced is 13,533 KB. </p>
  
  <p>Prior to using Delphi 2009, I was using Delphi 4. The executable it produced was only 2,671 KB while incorporating the same two components and basically having the same code as my current version.</p>
  
  <p>I do understand that Delphi 2009 is completely Unicode (which is the main reason why I upgraded), and being Unicode can cause up to a doubling of size. But this is about 5 times larger.</p>
  
  <p>Is there a reason why my executable has to remain 5 times larger? Or are there some simple ways to cut down a significant chunk of the executable size?</p>
  
  <hr>
  
  <p>Please note. Some people are answering with ways to compress the Delphi EXE. That is not what I am trying to do. I am trying to simply see why so much space is being used to remove what might not be necessary. If that is done, compression can still be done afterwards if so desired.</p>
  
  <p>It really doesn't matter how big or small the executable is once it is installed. It is for downloading purposes and to minimize server load and download times that you want to compress it. I prefer to use <a href="http://www.jrsoftware.org/isinfo.php" rel="noreferrer">Inno Setup</a> and compress the program inside the install routine itself. Then when it is installed, it is expanded to full size. That both prevents possible detection as a virus and eliminates the extra startup time needed to uncompress the program in memory. Also I code sign both my executable and my install routine and some compression techniques are incompatible with that.</p>
  
  <p>For more info about compressing, see the StackOverflow question:  <a href="https://stackoverflow.com/questions/800505/delphi-exe-compressor/800553">Delphi EXE compressor?</a></p>
  
  <hr>
  
  <p>ldsandon asked me to provide exactly what options I'm using, so here they are:</p>
  
  <p><a href="https://i.stack.imgur.com/3pzMp.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3pzMp.jpg" alt="Compiling Options"></a><br>
  <sub>(source: <a href="http://www.beholdgenealogy.com/img/compilingoptions.jpg" rel="noreferrer">beholdgenealogy.com</a>)</sub>  </p>
  
  <p><a href="https://i.stack.imgur.com/BppJL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/BppJL.jpg" alt="Linking Options"></a><br>
  <sub>(source: <a href="http://www.beholdgenealogy.com/img/linkingoptions.jpg" rel="noreferrer">beholdgenealogy.com</a>)</sub>  </p>