LIB release is huge compared to debugging

I have a static library project with standard debug / release build options. I was intrigued to notice that although debug.lib is a fairly large 22Mb, the release of one is a whopping 100Mb. And this is not a massive code base, about 75 classes, and none of them are very large.

My questions are: is this normal and should I care?

+6
visual-c ++
source share
7 answers

I would see if you statically link libraries in release mode and dynamically link them in debug mode. You might be statically linking the C ++ runtime.

+4
source share

I had the same problem. The fix is ​​very simple. Project Properties / Configuration Properties / General / Optimization of the entire program There is no optimization of the entire program instead of Using time code generation . The size of my static library has decreased from 5 MB to 1.3 MB.

+3
source share

Ideally, the lib release should be less than debugging.

I think you can statically link other libraries like MFC, ATL, etc.

check the release and debug configuration of the assembly.

use #pragma once to avoid including multiple temporary files.

+1
source share

No, this is not normal. It should be the other way around. Yes, you have to take care.

I would start by looking at the sizes again to make sure that I somehow could not tolerate the release and debugging sizes.

Then look at the libraries you reference for release and debugging. Did you accidentally link the debug library to submit and send the debug library?

Take a close look at your settings for release and debugging. Something very suspicious is happening.

+1
source share

Is it possible that a massive amount of this code is embedded, and the debug version is not "embedded"?

+1
source share

I would usually expect the opposite ...

Is it possible that the preprocessor has large pieces of code that include only the blocks that are part of the releases?

In this case, the boilerplate code is especially suspicious.

Update

I think the problem is most likely caused by linking to static libs in release mode and general libs in debug mode ...

+1 karoberts

0
source share

There is one thing that can explain this size: the debugging symbols built into the release build (as opposed to the built-in pdb). Are you sure you don't have any debugging symbols generated for your release build? (which visual c ++ are you using?)

0
source share

All Articles