Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.exe size

0 views
Skip to first unread message

Geoff Elder

unread,
Jan 6, 2001, 4:18:55 PM1/6/01
to
Hi,

I have a program of about 20,000 lines of code and when compiled the .exe is about 1.3Mb.

I made a few minor changes and it jumped to 1.8Mb. The other thing strange is a 'build' shows something like 60,000 lines compiled.
I've changed something by accident that I didn't intend to but I don't know what it is....

Any ideas?

Thanks in advance

--
Geoff


paul nichols

unread,
Jan 6, 2001, 4:28:14 PM1/6/01
to
Do you have code optimization on or off? What about debug information? Range
checking,etc.?

"Geoff Elder" <ge...@myraceresults.com> wrote in message
news:3A578BBF...@myraceresults.com...

Carl Caulkett

unread,
Jan 6, 2001, 6:30:53 PM1/6/01
to
In article <3A578BBF...@myraceresults.com>, ge...@myraceresults.com
says...

Hi Geoff,

Maybe you dropped a component on a form and then compiled or saved the
form before changing your mind. Compiling or saving will add the
appropriate unit to the form's uses clause. However, Delphi does not
automatically remove the unit if the component is removed. If the
component is part of a large package of interrelated units, this can add
a huge chunk of code to your app.

--
Carl

Alessandro Federici

unread,
Jan 6, 2001, 11:48:11 PM1/6/01
to
What about bitmaps and graphics?
Did you add any?


Geoff Elder

unread,
Jan 7, 2001, 2:50:05 PM1/7/01
to
Thanks for the suggestions. I finally solved it.
I looked for the things suggested here without luck. Then I looked
carefully at the file names while a build happened and noticed a few
strange files. I tracked those down, changed the directory name
so the build caused an error, found a stray unit that had been added
by mistake (by me) and removed it.
It seemed this unit caused a whole slew of other units to be added
which chewed up about 40,000 lines of code and 400k to the
.exe.

Thanks again,

On to the next problem.....

Geoff

John Kaster (Borland)

unread,
Jan 7, 2001, 5:57:36 PM1/7/01
to
Alessandro Federici wrote:
>
> What about bitmaps and graphics?
> Did you add any?

Just taking on here -- a great way to reduce exe size for resources is
to use frames for the resource and refer to the frame on all your forms
instead of unique copies of the resource.

Lovely Snooky

unread,
Jan 8, 2001, 1:10:37 AM1/8/01
to

Geoff Elder <ge...@myraceresults.com> wrote in message
news:3A58C86D...@myraceresults.com...

> It seemed this unit caused a whole slew of other units to be added
> which chewed up about 40,000 lines of code and 400k to the
> .exe.

Talk about Stefan H.'s boasting about Delphi's smart linker. Bah! Delphi's
Linker is still dumb. Is smart with trivial things within a unit such as
ordinary functions and procedures, but for those units that contain a big
fat bloated OOP objects with initialization where it will add tremendous
EXE, Delphi's Smart Linker is the best OXYMORON there is!


Dave Nottage

unread,
Jan 8, 2001, 1:52:00 AM1/8/01
to
"Lovely Snooky" wrote:
> Talk about Stefan H.'s boasting about Delphi's smart linker. Bah! Delphi's
> Linker is still dumb.

So the linker should be smart enough to know when a programmer has included
a unit that they didnt want to?

--
Dave Nottage
Pure Software Technology


Lovely Snooky

unread,
Jan 8, 2001, 2:07:44 AM1/8/01
to

Dave Nottage <da...@deletethis.b3.com.au> wrote in message
news:93bo3c$8q...@bornews.inprise.com...

> So the linker should be smart enough to know when a programmer has
included
> a unit that they didnt want to?

Isn't it really possible to automatically remove units where you did not
call anything from it, even initializations/finalizations that you do not
need in your code?


Vincent Parrett (VSoft)

unread,
Jan 8, 2001, 4:31:45 AM1/8/01
to
"Lovely Snooky" <one-wa...@moon.com> wrote in message
news:93boec$8f...@bornews.inprise.com...

>
> Isn't it really possible to automatically remove units where you did not
> call anything from it, even initializations/finalizations that you do not
> need in your code?
>

That would probably break a lot of exisiting code!

For example, I often include units in an application that register classes
with the delphi streaming mechanism. The units are not 'used' by any other
units in the application I also use the same technique to extend
applications, for example, registering forms with an application in the
initializaion section. I have a diagramming engine, in which I can add
object types to with one line of code to register them in the initialization
section. I could go on with dozens of examples of where your suggestion
would break exisiting code.

If the unit has an initialization section the linker has no choice but to
link in the unit, as initialization sections are meant be executed
automatically. It has no idea that you don;t really want it linked in! My
advice would be to clean up after yourself. By that I mean make sure you are
only including units that are needed. Simple but very effective.

HTH

Vincent Parrett

VSoft Technologies Pty Ltd

Email : vincent at vsoft-tech dot com dot au
Web : http://www.vsoft-tech.com.au


Joe Real

unread,
Jan 8, 2001, 2:12:48 PM1/8/01
to

"Vincent Parrett (VSoft)" <vin...@nospam.vsoft-tech.com.au> wrote in message
news:3a598961$2_1@dnews...

"Lovely Snooky" <one-wa...@moon.com> wrote in message
news:93boec$8f...@bornews.inprise.com...
<<If the unit has an initialization section the linker has no choice but to
link in the unit, as initialization sections are meant be executed
automatically. It has no idea that you don;t really want it linked in! My
advice would be to clean up after yourself. By that I mean make sure you are
only including units that are needed. Simple but very effective.
>>

Perhaps, she came from VB and MS VC++ eh? Linking everything in is the norm, and
has heard of Delphi's smart linker to alleviate the process. Darn! Delphi
requires that a developer be smart as well <g>! No wonder not a lot of
MS-fanatics are flocking over... Oops my apologies in advance (only if you think
this is not a joke).


Barry McClure

unread,
Jan 9, 2001, 10:18:26 AM1/9/01
to
John,
Is there a way to determine from the .exe or DCU's, which Delphi
units were actually linked in and how much they've contributed to the
size of the .exe file?

Barry...

John Kaster (Borland)

unread,
Jan 9, 2001, 1:23:30 PM1/9/01
to

There should be. Been a while since I looked at how the linker works,
but you should be able to determine what DCUs are in the binary, and how
large they are.

Petr Vones (Team JEDI)

unread,
Jan 9, 2001, 2:44:15 PM1/9/01
to
> Is there a way to determine from the .exe or DCU's, which Delphi
> units were actually linked in and how much they've contributed to the
> size of the .exe file?

You can get the information from MAP file. In Project | Options -> Linker page
check MAP file - Detailed (although, Segments would be sufficient) and compile
your project.

--
Petr Vones (Team JEDI) - http://delphi-jedi.org


0 new messages