How to lower the disk space taken by my programs!
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
How to lower the disk space taken by my programs!
Hi, I would like to know if you don't know some tips to lower the size of the applications made in c++ or even in other programming language...
I use wxDev-cpp, and I let it create all the basic files for my projects, but I noticed that even for a single window frame, the program takes about 3Mo!!
I don't know if this is due to the compiler...I think that the more librairies are included, the bigger the program will be, but I think that there must be another way...
I would like to share my programs on my future web site, but I don't see myself sharing a program of 3Mb which does nothing else but shutting the computer down (for example, or even saying hello world )
I think that every programmer has to deal with this problem one day. Do you know the key to doing this?
I use wxDev-cpp, and I let it create all the basic files for my projects, but I noticed that even for a single window frame, the program takes about 3Mo!!
I don't know if this is due to the compiler...I think that the more librairies are included, the bigger the program will be, but I think that there must be another way...
I would like to share my programs on my future web site, but I don't see myself sharing a program of 3Mb which does nothing else but shutting the computer down (for example, or even saying hello world )
I think that every programmer has to deal with this problem one day. Do you know the key to doing this?
Well ofcourse you can do this:
- Compile wx with optimized for size
- Make sure you compile a release version
- Use UPX (and lowjoel's great GUI for it) to compress the exe
- If all fails, build a wx lib with a lot of settings switched off. It is a pity there isn't such a config tool as the linux kernel has, to make it easy to configure it and remove / add stuff.
That's about the basic way to reduce size...
- Jorgen
- Compile wx with optimized for size
- Make sure you compile a release version
- Use UPX (and lowjoel's great GUI for it) to compress the exe
- If all fails, build a wx lib with a lot of settings switched off. It is a pity there isn't such a config tool as the linux kernel has, to make it easy to configure it and remove / add stuff.
That's about the basic way to reduce size...
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
Maybe it will help others, but not me, I work under Windows XP.Thanksuqkobi wrote:Hi,
In Linux you can use the command line tool "strip"
Hope that helps.
Well, I don't know what you mean, but in the project options/compiler, there is an option set to better optimisation.Jorg wrote: - Compile wx with optimized for size
Same as upper, I don't know how to do this...The only time I saw the word "release" was when I was entering the version information in the project options.Jorg wrote:- Make sure you compile a release version
Yeah, I had forgotten this stuff Btw, where can I find lowjoel's program?Jorg wrote:- Use UPX (and lowjoel's great GUI for it) to compress the exe
lol not possible for the moment, if only this could be done in less than an hour...Jorg wrote: If all fails, build a wx lib with a lot of settings switched off.
Build > Set Active Configuration > ReleaseGianT wrote:Same as upper, I don't know how to do this...The only time I saw the word "release" was when I was entering the version information in the project options.
Now compile. This will strip all of the debugging information out of your executable (which your users don't need anyways). This step alone takes my executable from 4.92 MB to 2.37 MB.
@Tyler: Thats for Visual Studio, hes talking MinGW/DevCPP.
To optimize in DevCPP, go to Projects -> Project Options -> Click Compiler Tab -> Click Optimiztions -> Make Best Optimizations say Yes
For me this is enabled by default. However my Executables still get bloated. The reason for this is GCC, it Bloats exe files. As seen with some game engines.
To optimize in DevCPP, go to Projects -> Project Options -> Click Compiler Tab -> Click Optimiztions -> Make Best Optimizations say Yes
For me this is enabled by default. However my Executables still get bloated. The reason for this is GCC, it Bloats exe files. As seen with some game engines.
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
Ok, gonna take a look at this.Marmis wrote:lowjoel's UPX with GUI can be found on his website: joelsplace.sg/studyroom/index.php
Mine is also enabled by default...Digi wrote:To optimize in DevCPP, go to Projects -> Project Options -> Click Compiler Tab -> Click Optimiztions -> Make Best Optimizations say Yes
For me this is enabled by default.
-
- Earned some good credits
- Posts: 124
- Joined: Wed Mar 16, 2005 5:44 pm
- Location: Guadeloupe, French West Indies
- Contact:
Ok! With the UPX compresser, I manage to take the size down to 600ko! I expected less, but it is far better than the 3Mo of the beginning.
Thanks.
>>Jorg: if you could explain what I didn't understand, maybe I could have a better result. Btw, I think you should put a thread in the FAQ which subject should be the subject of the current thread. This could help a lot of people.
Thanks.
>>Jorg: if you could explain what I didn't understand, maybe I could have a better result. Btw, I think you should put a thread in the FAQ which subject should be the subject of the current thread. This could help a lot of people.
-
- Can't get richer than this
- Posts: 802
- Joined: Mon Dec 27, 2004 10:46 am
- Location: Estonia, Tallinn
- Contact:
http://wiki.wxwidgets.org/wiki.pl?Reduc ... table_Size
---
As for strip being only on Linux supposedly - I believe that as mingw32 is basically gcc, then strip also exists to strip the executables made by mingw32 on Windows.
---
As for strip being only on Linux supposedly - I believe that as mingw32 is basically gcc, then strip also exists to strip the executables made by mingw32 on Windows.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
-
- Knows some wx things
- Posts: 27
- Joined: Thu May 26, 2005 10:39 am
- Contact:
Hi!
Just a sidenote:
When stripping the executable it usualy gives better results to do it at compile time instead of running "strip" on it. Using gcc use the -s switch to enable stripping when compiling.
Just a sidenote:
When stripping the executable it usualy gives better results to do it at compile time instead of running "strip" on it. Using gcc use the -s switch to enable stripping when compiling.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
-
- Part Of The Furniture
- Posts: 1511
- Joined: Sun Jun 19, 2005 11:37 am
- Location: Singapore
- Contact:
well ya i know there are bugs in my upxgui.... so cast your vote on http://forums.wxwidgets.org/viewtopic.php?t=2977 on whether I should start a sf project for it... i wanna know...
and those who choose yes and what to help dev it, PM me and lemme know
thanks
joel
P.S. at this point in writing upxgui is a "wrapper" it just calls on it. i might like to integrate it, but not that this time. so ur vote counts!
and those who choose yes and what to help dev it, PM me and lemme know
thanks
joel
P.S. at this point in writing upxgui is a "wrapper" it just calls on it. i might like to integrate it, but not that this time. so ur vote counts!
- Ryan Norton
- wxWorld Domination!
- Posts: 1319
- Joined: Mon Aug 30, 2004 6:01 pm