Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 generated executable size larger

I've got an C++ application originally written with Visual Studio 6.0

The application is standard and raw Win32 API, no MFC(*Edit 2), no .NET, statically linked, multi-threaded executable.

I have migrated through all versions of Visual Studio up to 2010 (today) and never had any problems until now:

It compiles and runs perfectly with VS2010 BUT the generated executable size is four (4) times larger!

I've tried all the options I know (optimizations, remove debug info, etc..) with no results. Granted, I am new to VS2010, but not to Visual Studio.

Has anyone encountered this problem? Again: I am NOT using any frameworks, it is a raw, statically linked, Win32 application, no DLLs, no ODBC, no network, no .NET

Hoping to see my executables small once again, I thank you for any input.

  • Edit 1: Original Size=626KB (VS6.0, VS2008) Bloated size=2.013KB (VS2010)

  • Edit 2: After some research and dumps, I discovered a hidden reference to MFC. Originally I said it did NOT use MFC, but it does.

like image 778
Migs Avatar asked Mar 02 '11 13:03

Migs


People also ask

Why are executables so big?

For example, a simple "hello world" program can generate an executable that is larger than most people expect (40+K bytes). One reason executables can be large is that portions of the C++ runtime library might get statically linked with your program.

How do I reduce the size of my Visual Studio?

View > Appearance > Zoom In (Ctrl+=) - increase the Zoom level. View > Appearance > Zoom Out (Ctrl+-) - decrease the Zoom level. Source - https://code.visualstudio.com/docs/editor/acces... There are links to non-Microsoft websites.


1 Answers

The increase in size may be caused by changes to the MFC. Here is an explanation, and here is a workaround by the same author that brings the executable's size back down into regions where it was with 2008. The workaround involves editing copies of MFC source files, though, a process not everybody may be happy with, and which needs to be repeated after every update, e.g. after installing a Visual Studio service pack.

Update:

It looks like the OP does not use MFC, so these might be two different issues. I have experienced the size increase myself but unfortunately cannot say whether caused by MFC or not since my project statically links to the MFC.

like image 114
Helge Klein Avatar answered Oct 05 '22 22:10

Helge Klein