Why does generating pdb files increase the size of my native C++ exe?

若如初见. 提交于 2019-12-21 01:48:08

问题


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.


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6651107/why-does-generating-pdb-files-increase-the-size-of-my-native-c-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!