Sascha
Sascha

Reputation: 1146

Visual Studio 2005 - A binary built with /DEBUG /OPT:REF is much larger than non-debug-build

In our case, the /DEBUG binary is 50% larger, the binary built with /DEBUG /OPT:REF is still 40% larger. From the answers in Visual Studio: debug information in release build I expected a release build with debug information shouldn't be that much larger. What are we missing?

This is one major reason why we're currently shipping the stripped binary, instead of one that's easy to debug. I'm not the build master, so please bear with me.

Sizes:
22MB with /O2
35MB with /O2 /DEBUG
32MB with /O2 /DEBUG /OPT:REF

Upvotes: 1

Views: 879

Answers (3)

orcy
orcy

Reputation: 1372

According to the VS2005 documentation at http://msdn.microsoft.com/en-us/library/xe4t6fc1(v=vs.80).aspx:

/DEBUG changes the defaults for the /OPT option from REF to NOREF and from ICF to NOICF (so, you will need to explicitly specify /OPT:REF or /OPT:ICF).

So to reduce the size you can try to specify both:

/O2 /DEBUG /OPT:REF /OPT:ICF

Upvotes: 1

Ajay
Ajay

Reputation: 18431

Code probably won't product that large binary. Few hints:

  • Are you using Static Library, instead of Dynamic Linking, specifically MFC DLL?
  • Having large set of resources, viz. icons, bitmaps, string resources, custom resources?

Upvotes: 0

BlueWanderer
BlueWanderer

Reputation: 2691

If it was written in C++, STD could be complied much larger when not optimized. But I'm not sure if that is the case. How large in bytes exactly is that 50%?

Upvotes: 1

Related Questions