Question

How to reduce delphi EXE size???

Asked by: mis82

Hello,
  Just i want to know if there is a way to reduce the size of the exe file after compile  becaouse its more than (300 KB) while in VB and VC++ its (20 KB)  can i use the delphi without graphics or without forms with same functionality?

Note : i dont want to use console application because i cant use components and also i dont want to open the dos window in my applications.
Thank you all...

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-01-16 at 14:46:55ID20853506
Tags

delphi

,

exe

,

reduce

,

size

Topic

Delphi Programming

Participating Experts
10
Points
125
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Reducing System Resources
    My program uses a lot of resources, I using Delphi 3. I want someone to provide to me, efficient tips for reducing the resources that a Delphi application needs (most, the better)
  2. reducing exe size
    Hi, all!! Just a question.. I notice that when I zip a delphi compiled executable that the size reduces more than with most other executables. Is there a way to reduce my exe-size from within Delphi? Or is there a tool for this? Thanks! Alex
  3. another DELPHI beginner
    lots of questions 1) Do I have to shell out lot of money to buy delphi programming kit? is there a freeware developer release available? since I wont be using it commercially and I will be using only for learning for the next few months and I will of course buy some kit when...
  4. DELPHI 6.0
    How do we reduce the size of Delphi 6.0 compiled exe ? Delphi 3.0 compiles a 290 Kb while Delphi 6.0 gave me a 450 Kb one ! exact same source !
  5. how do i reduce the delphi exe file size
    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 ,
  6. Hiding Delphi Console Window
    Hi, I've notcied that when you make a console application in delphi it significantly reduces the filesize, assuming you only use the SysUtils in your uses. I was wondering if maybe there was a way to hide the console window? So bascially a program that runs invisibly or just ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: rllibbyPosted on 2004-01-16 at 15:11:34ID: 10133832


Yes, but it will all depend on:

1.) How much effort you are willing to put into it
2.) If you don't mind runtime baggage....
3.) If you don't mind learning new things
4.) If you don't mind using other tools after the exe is built

First, you should realize if your looking at a VB/VC app (with a window and controls) that is 20 K in size, then it *most* likely requires run-time dll's in order for the app to run.

For starters, the biggest (one of anyways) size offender in Delphi is the forms unit, which accounts for appx 200K (varies by Delphi version). SysUtils and Classes adds another appx 60K, the Controls unit, your code, the base 16K required by the System unit, etc... you get the picture I'm sure. It all adds up. So your choices for Delphi?

1.) Use runtime packages. But this also means the runtime packages need to be available with your application. Small exe, but baggage drag-along requirements. (similar to the VB/VC projects)

2.) Write the code using straight api's. This is do-able for very small apps, but gets messy pretty quick when dealing with larger apps. Does make some VERY small exe's though. Downsize is that it requires coding experience with writing a windows main function, message handling, etc. No drag-drop coding.

3.) Use an exe-packer on the .exe file after the project has been built. Requires additional steps when compiling, the tools are usually not free (there are free ones though). Produces average size reduction.

4.) Strip the rellocation table from the exe after it has been built. (believe there was even one written in Delphi). Only provides a modest size reduction. (5-20K).

5.) Use another code library, say KOL for example. Downside is the rework that can be involved, plus the extra learning curve.

---
Or, just leave it as it is, and realize that you don't have to distribute anything but your executable.

Hope this helps,
Russell


 

by: EolazPosted on 2004-01-17 at 00:30:26ID: 10135345

Hi, if your wanting a quick and easy way to size down your exe, the best and simplist has to be ASPACK, all you do is open ASPack and load the exe into the program and compress, and thats it your exe is now almost 50% its normal size.

but with all exe compressions each time you execute a command it has to pass though the memory like 5-8 times.

but you got 2 way up the odds, if you don't compress your Apps, people will ResHaX your Program :( and change your programes layout and stuff, which is a downer, so compress it, is a must for that.

you could learn another lang in delphi like API, take ya like 2-4 months of solid learning and then you will get some small exe sizes.

but if all you want is to make the exe smaller and stop people from ResHaxing then ASPack is the way 2 go, takes 5seconds 2 compress a exe by 50%, easier than learning another part of the lang just for file size.

http://www.aspack.com/

Hope this helps some

 

by: EolazPosted on 2004-01-17 at 00:39:49ID: 10135361

If you want 2 Strip the Rellocation Tables You could use this below it will strip off around 50kb or even more

http://www.jrsoftware.org/striprlc.php


this text below is from the web site...

Some have asked why I made StripReloc when there are EXE compression programs such as ASPack and UPX that will trim more bytes off of executables than StripReloc ever could.

The reason is there are downsides to using EXE compressors. Most notably:

Upon startup of a compressed EXE/DLL, all of the code is decompressed from the disk image into memory in one pass, which can cause disk thrashing if the system is low on memory and is forced to access the swap file. In contrast, with uncompressed EXE/DLLs, the OS allocates memory for code pages on demand (i.e. when they are executed).
Multiple instances of a compressed EXE/DLL create multiple instances of the code in memory. If you have a compressed EXE that contains 1 MB of code (before compression) and the user starts 5 instances of it, approximately 4 MB of memory is wasted. Likewise, if you have a DLL that is 1 MB and it is used by 5 running applications, approximately 4 MB of memory is wasted. With uncompressed EXE/DLLs, code is only stored in memory once and is shared between instances.
Some older virus scanners flag compressed EXE/DLLs as being virus-infected. (This is this reason I stopped compressing Inno Setup's EXEs.)

 

by: mis82Posted on 2004-01-17 at 01:16:43ID: 10135426

Hello again
Eolaz, tell me what about the api langauge  is it a delphi language?
and how can i open its page in delphi 7?
and is there any book to learn ??
thank u...

 

by: DragonSlayerPosted on 2004-01-17 at 06:17:24ID: 10136064

for info about WinAPI and Delphi, check out http://www.angelfire.com/hi5/delphizeus/index.html

 

by: EolazPosted on 2004-01-17 at 09:37:27ID: 10136830

API is Delphi you can make it with Delphi 7, but there is a slight edge with api, they maybe the same in some cases, but Delphi normal and Delphi api they are 2 separate langs, based around the same methods.

each has there good and bad sides, when working with api, when you work on a large project, it sometimes can get messy, api is for the small basic apps that are easy to make and you can live with the small size.

but if your making big projects with allot of code, you should stick with normal Delphi lang than moving over to api lang.

for most, an exe compressor is all people need, using a compressor is easier that learning a separate lang and the amount of coding time that is involved with api, its much harder and complexes.

api cuts out most of the middle man stuff, so you have 2 do the work your self

it cuts down the time needed to learn the separate lang of api and coding time.

if your making an good large app, then the size probly wouldn't matter once its on the users computer, and a exe compressor like aspack, is a 5 second compress for 50% of your exe size, a 500kb file is like 230kb file and even if it has to go though the memory 5-8x, its unotisble, plus compressing your exe will stop reshaxers leeching your layouts and info that is stored inside your exe.

so in all after working everything out, on how much time to the means of what your trying to do. 4-6months of learning api or a 5second compression with exe reshax protection.

in the end, its up to you which method will suit you.



I my self prefer to compress my files the easy way, less time and no wasted effort coding api, my app is compressed and reshax protected within seconds, so I have more time coding the more important things.

http://www.aspack.com/ - its the easiest and hassle free :) its simple as counting 1 2 3.

beleave me I've tryed it all and in the end, aspack is the best course of action for all your needs :) all that wasted time learning api and faffing around with it, its one hassle I don't need when making a large project, I might as well have stook with cpp, you know what I mean.

http://www.aspack.com/

for your needs at the moment use something easy, and use your time on coding your needed projects.

you should have a more clear outlook on things now. :)

 

by: umuligPosted on 2004-01-18 at 07:56:18ID: 10140531

UPX is a good option to ASPack as it's free.

http://upx.sourceforge.net/

 

by: DelphianPosted on 2004-01-21 at 17:50:55ID: 10170500

Hi mis82 and all,

An another way of reducing executables from getting
big is using Delphi's OO abilities, specially visual
form inheritance. This save a LOT of resources. A
framework to create and setup dynamically some simple
and heavily used custom dialogs also helps.
And using TImageList components instead of setting
icons directly on the buttons/tool buttons/etc.
If you have big bitmaps on the application and use
them in various forms, try to get them on one form
(since the simplest way save them is to put various
TImages on that form - datamodules don't accept visual
components) and the others only reference them.

This can help make the EXE smaller and make the
app get faster.

[]s Fabricio

 

by: eagle00789Posted on 2004-01-23 at 00:48:34ID: 10182335

If you use any of the compression programs mentioned above (with the exception of StripReloc), just keep in mind, that if you run your program 2 times, that your 2 programs occupy much more memory because the program has to be unpacked in memory first.

I only recommend it, when your program is limited to run only once at a time, and is prohibitted frum running multiple times.

From the StripReloc-page, explaining the pro's and con's of compressing:
--
Upon startup of a compressed EXE/DLL, all of the code is decompressed from the disk image into memory in one pass, which can cause disk thrashing if the system is low on memory and is forced to access the swap file. In contrast, with uncompressed EXE/DLLs, the OS allocates memory for code pages on demand (i.e. when they are executed).
Multiple instances of a compressed EXE/DLL create multiple instances of the code in memory. If you have a compressed EXE that contains 1 MB of code (before compression) and the user starts 5 instances of it, approximately 4 MB of memory is wasted. Likewise, if you have a DLL that is 1 MB and it is used by 5 running applications, approximately 4 MB of memory is wasted. With uncompressed EXE/DLLs, code is only stored in memory once and is shared between instances.
--

Greetings Chris

 

by: tongPosted on 2004-03-14 at 05:01:26ID: 10591703

http://www.undu.com/DN970301/00000064.htm

Is these help ?

Someone said adjust Project/Options/Complier will rip off 50 - 100k



 

by: SaLzPosted on 2004-03-14 at 06:35:10ID: 10591927

use delphi 8 vcl, a normal empty app is only 9kb, I made a wrm and it was only 15kb, a perfect size.

 

by: smhpPosted on 2004-04-10 at 08:05:04ID: 10797016

ASPACK

 

by: swift99Posted on 2004-04-12 at 14:38:19ID: 10808853

I computed the cost of a meg of RAM at $0.50, and a meg of hard drive at $0.001.  The cost overheads of the more capable hardware is more than offset by the cost savings of the libraries.

I use packages for flexibility in remote deployment, and don't worry about the app size.  It would need to save many megs of RAM to pay for my time in development.

 

by: SaLzPosted on 2004-04-13 at 18:08:22ID: 10819256

rofl swift99 I lov that comment! ya your right size doesn't matter wink wink, smaller the better with the apps ey lads :P

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...