views:

132

answers:

1

I have a Visual Studio 2008 C++ project that outputs a static library and uses some functionality of the Boost Library. When I build the project in Debug configuration, the .lib file is 7.84 MB. When I build the project in Release configuration, the .lib file is 23.5 MB. !!!!

The only Boost headers I include are:

  • boost/function.hpp
  • boost/exception/all.hpp

Since this is a static library, I don't have any Boost library files specified to include, but somehow it's a ginormous output. When I use that static library in a test executable, the resulting .exe file is only 746 KB in Debug and 231 KB in Release.

The problem is that I have to create a "release" of the library to check into a different repository to be used by other projects. And I would prefer not to have to add 30 MB of files each time I update it. And if nothing else it really confuses me as to why the Release build is 3 times the size of the Debug.

Anyone have suggestions as to what I'm doing wrong?

Thanks, Matt

+2  A: 

Project + Properties, C/C++, Optimization, Whole Program Optimization = No. That at least ought to keep your Release build size from blowing up. I can't repro the debug library size, just the headers gives me a 111KB .lib.

Hans Passant
That took the Release build down to 5.41 MB. Much better. Does changing the value of Whole Program Optimization to No affect the speed and performance much in this case?
CuppM
It has no effect until you try to optimize the program with the Whole Program Optimization feature. If you never heard of it then you won't miss it. If you do then you can just create a different build configuration.
Hans Passant