EXE/DLL size
-
How can I figure out why my exe/dll is so big. Working with MSVC 6. How do I read .map file?
Lots of reasons your exe/dll may be verrrry big. One major reason is that you may be compiling for Debug. Another major reason is that MFC bloats your program. Here is an exert from a map file I just created for my project. In order to understand the map file you need to also understand a little about assembly language and how the linker puts program object/library files together. Your program is divided into two parts (or segments) -- CODE and DATA. The CODE segment contains all the program instructions that you write in your program as well as all statically-linked libraries and object modules. The DATA segment contains all global and static data objects. Data objects you put as members of a class go into DATA segments, while the code for the methods of the class go into the CODE segment. As you can see from the map file I show below, there can be more than one DATA and more than one CODE segments. The term "segments" I use here does not mean the same in the Win32 environment as it did in the old 16-bit Win3.1 and DOS environments. In Win32, there is really only one segment defined in the computer -- thus the name "flat memory model". If you have 128 meg RAM in your computer, Win32 allocates all of it to one gigantic segment, then partials it out as CODE or DATA to various processes and threads. For more in-depth and more accurate details you need to read several large books or get yourself a Ph.D in computer science. The last part of the map file shows the size of each public symbol (functions and data objects) that is statically linked into your exe/dll. The names are "mangled" mainly because of the C++ capability to have two or more methods with the same name within either two different classes or within the same class. Each compiler vendor (Microsoft and Borland for example) have different alrogithms for producing mangled names, and the map files will reflect this difference. For MSVC, the mangled name consists of the original name you gave it in your class plus the names of the arguments and some additional funny-looking characters. About the only useful thing I have seen the map file used for is to figure out what function a program is crashing in. It doesn't say a thing about where the real bug is, but only where the bug got so bad that the program eventually failed. Hope this helps a bit (or byte). Timestamp is 39d29f39 (Wed Sep 27 20:30:33 2000) Preferred load address is 00400000 Start Length Name Class 00