Why does generating pdb files increase the size of

2020-06-03 08:10发布

Just by turning on Configuration Properties > Linker > Debugging > Generate Debug Info the size of my exe has increased from 2.11MB to 2.34MB

  1. What is that extra ~230KB being used for? I thought the exe should be roughly the same size (give or take an extra path to the pdb file) but not that much. Would there be any performance hit from this "bloat"?

  2. I've also seen Configuration Properties > C/C++ > General > Debug Information Format set to disabled in release mode while the pdb files are set to generate, is there any reason why this would be? From what I can tell the exe is the same size - it's just the PDB that gets bigger when you enable Program Database, I can't see a problem with this but I want to make sure there isn't some piece that I'm missing considering Program Database is the default for new projects in the release configuration.

3条回答
疯言疯语
2楼-- · 2020-06-03 08:35

The size of the EXE is likely utterly irrelevant to the performance.

查看更多
ゆ 、 Hurt°
3楼-- · 2020-06-03 08:38

The increase of size of the executable is probably due to the compiler including code that would have otherwise be optimized away. Try linking with /OPT:REF, and see if that drops the size back to around what it was.

As for the performance hit, it should not be significant. The bloat might cause caching of code to be less efficient, but on most cases that would be neglectable.

查看更多
地球回转人心会变
4楼-- · 2020-06-03 08:43

Not just path to PDB file, but the "Debug" in executable's image header, internal GUID to ensure correct PDB file is loaded while debugging/crash-debugging.

查看更多
登录 后发表回答