Executables twice as large - by RudyK

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 619913 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/8/2010 4:31:36 AM
Access Restriction Public


Probably not really a bug, but I wonder why executables compiled and linked with VS2010 are twice as large compared to VS2005?
The C++ projects are the same, but of course converted to VS2010.

All OBJ and RES files are approximately the same size in VS2005 and VS2010, so it must be that either the standard LIB's are larger, or the linker does something different.

DLL projects also produce larger DLL's, about 50% larger.
Sign in to post a comment.
Posted by Microsoft on 5/10/2011 at 4:19 PM

Thanks for the report. This issue has been addressed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 11/14/2010 at 10:54 PM
Thanks again for your feedback. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by RudyK on 11/10/2010 at 5:57 AM
It just dawned on me to use the MFC headers and libraries from VS2005 and the exe is back to its normal size.

I would still prefer to use the 2010 version if I can opt-out to get all this additional code that I don't use.
Posted by RudyK on 11/10/2010 at 4:37 AM
Sorry, I meant to say afxglobals.cpp instead of afgglobals.cpp of course.
Posted by RudyK on 11/9/2010 at 7:27 AM
Thanks guys.

My projects indeed statically link MFC, but I cannot get the solution in the blog post mentioned by Adam to work, because the copy of afgglobals.cpp won't compile with heaps of errors other than the ones mentioned in the blog.
I am affraid if I remove too much I will break code.
There is also an inconsistancy in the use of NTDDI_VERSION. Certain class member variables of the AFX_GLOBAL_DATA class are only defined if NTDDI_VERSION>=NTDDI_WIN7, while the constructor implementation always includes the initialization of these members. That suggests afgglobals.cpp never compiles for Win XP for example?
Any suggestions?

MS should really make it an option to include extended new features, because it is rediculous that an exe grows by almost 2MB for features that are not used anyway. In my case the app grows twice as big and that's not good for something people must download.
Posted by Microsoft on 11/8/2010 at 7:29 PM
Thank you for reporting this issue.
As Adam said, could you please tell us what type of project you are working with?
Posted by ildjarn on 11/8/2010 at 10:49 AM
Are you using MFC? If so, see this blog post: http://tedwvc.wordpress.com/2010/05/27/how-to-make-small-statically-linked-mfc-exes-in-visual-c-2010/
Posted by Microsoft on 11/8/2010 at 5:22 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)