Author Topic: Large output file size  (Read 7676 times)

Offline yeyidogan

  • Single posting newcomer
  • *
  • Posts: 4
Large output file size
« on: April 25, 2009, 12:56:54 pm »
Hi,

I am a new user of CodeBlocks. After 2 long day, I have created my first gui application on windows.
I am using mingw, wxpack and wxsmith and codeblocks.

My output file (...exe) is very large.
Debug output is 35 MB.
Release output is 2.5 MB.

Why the output files are large?

Thank you all.
Yilmaz Eyidogan

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
Re: Large output file size
« Reply #1 on: April 25, 2009, 03:30:21 pm »
best regards,
p7
 Free open source UML modeling tool: ArgoUML

Offline yeyidogan

  • Single posting newcomer
  • *
  • Posts: 4
Re: Large output file size
« Reply #2 on: April 25, 2009, 11:09:03 pm »
Thank you polygon7,

I have tried that settings, but there is no change.
I have created a new project and copied old files to new project. The output file sizes are:
Debug:  5.022 KB
Release: 2.430 KB
So debug is decreased from 30 MB to 5 MB. But release output file size is same.

I am looking at firefox.exe. It is 301 KB. But my basic gui software is 2.5 MB  :shock:

Thank you.
Yilmaz Eyidogan

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Large output file size
« Reply #3 on: April 26, 2009, 08:48:48 am »
Hello,

You can try "strip -s program.exe". Most of the time, this will strip a little more unnecessary info from the executable, even though you specified -s on the linker command line.

>> I am looking at firefox.exe. It is 301 KB. But my basic gui software is 2.5 MB  Shocked

This is because firefox.exe uses dynamically linked libraries, it will load the libraries only when it is necessary.

Best regards,
Ramazan Kartal

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: Large output file size
« Reply #4 on: April 26, 2009, 01:46:30 pm »
hi,

I made some similar experiences... in the end though, the size relies before all on the functionalities you put into your code. How much lines of code do you actually have. You said, you programmed it in two days, so it can´t be much more than, lets say, 1500 lines, assuming you are not one of those coding geniouses out ther ;)

Compiler settings is not all. I assume you code in c++ ? Probably you include explicitly or implicitly much more "outside" libraries than you actually need, first I would check all the headers in your files and figure out, if you really need them all, sometimes this works wonders. Another thing would be to check the usage of STL standard templates. If you use twenty std::map<> all with different template signature, your code could also inflate a lot.

But using wxWidgets you almost always end up with the cuoted sizes of executable when everything is staticaly linked ...

The most important would be to tell us, what type of programm it is, how many files, what functinalities, which dependencies, and so on...
If not it is rather dificult to judge if your csae falls under normal sizes or not. Anyways: hurry, because this topic is likely to be blocked soon by the moderator of the forum, as it seem to be more a general programming issue rather than having to do with code::blocks

Regards

nausea
« Last Edit: April 26, 2009, 01:48:49 pm by nausea »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Large output file size
« Reply #5 on: April 26, 2009, 04:52:51 pm »
In short, if you use wxWidgets, then don't complain about disk space. wxWidgets is huge, both in functionality and code size, and using it always means to use a lot more space on disk -- this is the price you have to pay for using a huge framework. It's the same with using languages like C++ that offer exception handling and universal standard libraries. Those things aren't free.
On modern computers, 5 MB are nothing, anyway. It's not like 5 MB is half of the size of your hard disk like in the 1980s :)
Most people nowadays don't even notice 5 MB when they have to download them (that's how long...2 seconds?), thanks to widely available high bandwidth internet. Remember the time when 2400-bit/s was top of the line...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline yeyidogan

  • Single posting newcomer
  • *
  • Posts: 4
Re: Large output file size
« Reply #6 on: April 26, 2009, 08:08:00 pm »
Thanks for all answers.
As I understand the above descriptions, I created a new project with that settings:
Preffered GUI Builder: wxSmith
Application Type: Frame Based
wxWidgets' Location: D:\SourceCode\Libraries\wxWidgets2.8 (wxPack_v2.8.9.02)
Compiler: GNU GCC Compiler
wxWidgets Library Settings: checked Use wxWidgets Dll, checked wxWidgets is build as a monolithic library, checked Enable unicode.
Miscellaneous Settings are unchecked.

I compiled that project:
Release output file size: 71.50 KB  (wonderful  :D)
Debug output file size: 1984 KB

But to run mytemp.exe, wxmsw28ud_gcc.dll is required in the same directory. But it is 91 MB.

Is there any way to use exe file with dynamically linked libraries as firefox :)

with best regards,
Yilmaz Eyidogan
Yilmaz Eyidogan

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: Large output file size
« Reply #7 on: April 26, 2009, 08:54:46 pm »
hi,

the library wxmsw28ud_gcc.dll is the unicode debug version of wxWidgets, it may be bigger than a non-debug version to link dynamically.

also you could search for or try to compile wxWidgets not as monolithic, but as modular, and not include those parts of wxWidgets you don't need for your app, that could save some space for the dynamic library too.

regards

nausea
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline yeyidogan

  • Single posting newcomer
  • *
  • Posts: 4
Re: Large output file size
« Reply #8 on: April 26, 2009, 10:21:25 pm »
Hi,

I will work on wxWidgets.
So I have to read all wxWidgets documents in wxwidgets.org

Vbr,
Yilmaz Eyidogan
Yilmaz Eyidogan