how do i reduce the delphi exe file size

Posted on 2003-03-20
Medium Priority
Last Modified: 2010-04-04
Hi everyone
              how do i reduce the delphi exe file size, if i create a application in delphi the minimum size is 360 kb , but in other languages i can create it in two digit kbs , so how do i over come this , and what increases the file size of a delphi application ,
Question by:samuel_chinnu123
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 34

Accepted Solution

Slick812 earned 120 total points
ID: 8178881
hello samuel_chinnu123, the file size of a new delphi app is mostly fron the Forms unit, there is alot of code there for the many things needed to have the  many runtime options for component creation and thing for safety, and to make a delphi app robust (exception handling). . . but alot of of that code is not needed in most programs. To reduce the size of your programs, You can get a Program compressor, I sometimes use  UPX  which is avaiable at


Or you can maybe try the Key Objects Library, an alternative to the VCL, which gives smaller file sizes, you can see this at


Or you can NOT use the Forms unit, and just do API programming, but this take some time and effort to learn, you can get info about this at -


Expert Comment

ID: 8179186
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8183139
the easy way...
-Use delphi 2
-Use ResHacker to pull out all unneeded resources from exe
-Pack with UPX using this command line
UPX --best MyApp.exe

the hard way...
Use KOl library or use API

The really hard way..
Give up on delphi and use something like the free LCCWin32 C compiler... you will be rewarded with extremely small size exes... some of mine are 5kb in size.

You might also use the free BCX basic to C translator... it turns basic source into C source that LCCWin32 can compile... BCX is nearly as easy to use as Delphi.. it is free and has a nice rad environment called ezide.
There is also a user group for BCX full of friendly guys that will help you along.


Expert Comment

ID: 8183195
As to what increases the size of a delphi exe

Borland decided that being able to quickly develop programs was more important than making them really small... and they are right!

But if you compare Delphi apps to VB apps you will see that it is VB that is bloated. The runtime file for VB is just HUGE... compared to that delphi makes small exe's.

With 512mb memory chips at 49.00 and 120gb HDs at 120.00 exe size is NOT important unless you get beyond 1mb. Anything less than 1mb can be downloaded quickly even on a 28.800 dial-up :-)

Expert Comment

ID: 8364588
In delphi select Project|Options and select the Linker tab, set Map File to Off, set Linker Output to Generate DCUs and untick all the EXE and DLL options.

All EXEs created in delphi have a .reloc section which for EXEs is never needed as they never get relocated in memory like dlls do. so to get rid of that you can use StripReloc from


the source code is included with this too :)

once you strip the .reloc section from your EXE you could then use UPX as mentioned above to further reduce the size

The only other thing i can think of would be to copy the forms unit (rename it to MyForms) and take out all the code you can that still allows your code to compile then in the uses section, replace Forms with MyForms(i had done this before and it worked wonders for me, but i have gone through a few Hard Drive formats since then forgetting to back it up and i can't be bothered to go back through it again)

Hope something is useful to you

Hill Groover

Expert Comment

ID: 9316645
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question