Search code examples
c++visual-c++sizerelease-mode

Visual C++ express 2008: Why does it places megs of null bytes at the end of the release executable?


Recently I have discovered that my release executable (made with msvc++ express 2008) becomes very large. As I examine the executable with a hex viewer I saw that only the first 300k bytes contains useful data the remaining bytes are only zeros - 6 megs of zero bytes.

The debug built exe has 1MB size, but the release is 6.5MB.

Why does MSVC++ express do that useless thing? How can I fix it?


Solution

  • Did you define large arrays at file-scope in your program? That might be one reason. You can use the dumpbin program to see how much space each section in the exe file takes, that should give you a clue to the "why".