Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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

Technology Partners: 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!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

581 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