Tim Raleigh

Visual Studio 2005 produces (MFC Dialog based Smart Device) executables for the 2003 platforms that are drastically larger in Debug mode.

I created a blank project in EVC 4.0 and the debug size was 13K and release was 8K

I created a blank project in VS2005 and the debug size was 104K and release was 33K

Now for large projects, a debug exe in EVC 4 was 4.2MB and in VS2005 it is 11MB. Ouch!

I've played with compiler and linker options but have had no success reducing the exe size. I a mostly concerned with the Debug exe size. Any thoughts

The test I ran to produce the above results

EVC 4 - new project - WCE MFC AppWizard exe - Dialog based - Finish

VS2005 - Smart Device - MFC Smart Device App - Next - 2003 (only) - Next - Dialog Based - Shared Dll - Finish



Re: Visual C++ Language Debug Executable size

einaros

Is this a problem Debug executables obviously aren't compiled with any optimization, to make it easier to analyze and debug -- and that will make them large. There have been some changes to the size along with the new VC++ versions, but unless you're having specific trouble with this (in which case you'd have to specify those), there's not much anyone can do but nod and smile.





Re: Visual C++ Language Debug Executable size

Tim Raleigh

There are two issues. First is it is not posssible to use Memory Leak tools (e.g., CodeSnitch) to test for memory leaks because the image is just too large. The second, issue is that only 2003 devices with 128MB of memory will actually execute the application in debug mode. Debugging on many popular devices is not possible (e.g., HP 4700). We have 2000 users with a wide range of devices, that when there is an issue, we will need to debug.

It also takes a long time to download the image to the device, but I can live with that Smile I would fine with just having the ability to find memory leaks to ensure the code is ok.





Re: Visual C++ Language Debug Executable size

einaros

I accidentally marked your post as the answer. Disregard that mail alert.

Anyhoo, I can't say much above the device development, as I've never been into that. I have seen many posts on the debug exe size around these forums, though (particularily in VC++ general). I'm sure you'll be able to find more if you do a few searches.

In either case, to keep the size down you should minimize the amount of dependencies. Identical comdat folding and removal of unreferences functions / data are also both turned off by default in the debug build, so you could try turning those on (in the linker's optimization section). If you're using templates heavily, the lack of ICF can cause your code size to grow something awful.





Re: Visual C++ Language Debug Executable size

Red Swingline Stapler

As einaros pointed out, this is really just a characteristic of Debug executables, which are built (by default) without any optimizations. Under VS2005, Debug executables are slightly larger than they were in 2003, however not so much that this should be a widespread problem.

You can build a Debug version with some optimizations in place (such as "Optimize for size", "Enable string pooling", and so forth). This might help. Another option is to restructure your executable. Break out some functionality into DLLs so that no single module is over (for example) 1MB in size.

This is good design and will often result in a smaller working set for your application, i.e., less page faults and overall better performance.





Re: Visual C++ Language Debug Executable size

Tim Raleigh

Tweeking the Identical comdat folding seemed to make the big difference. I got the 11MB exe down to 5 so I am happy as can be. Thanks!!!