Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
Thanks, Wes. I was able to resolve the problem by installing Visual Studio 2012 Express and recommended components, removing the offending line from the Microsoft.Cpp.Platform.targets file (double-clicked error message), and compiling as Release.
It might depend on the implementation of the multimap. I checked it long ago but if I remember right your erase() call sets back the allocation to a minimum, identical to the allocation performed by the default ctor of multimap (at least in the SGI stl implementation of Visual C++ I used at the time). Note that even newly created empty std containers have a small piece of memory preallocated and some containers (like std::vector) dont shrink the size of the allocated memory area (capacity) even if you erase items.
A trick that seems to reset the allocated memory of any std containers regardless of stl implementation and container type is the following:
typedef std::multimap<int,int> MyMap;
// We create a new map instance and we swap its contents with the other "big" container instance.
// This swap operation replaces the pointers inside the two containers so after the swap() the
// global_map contains the small newly allocated blocks, and empty_map contains the big mem blocks
// previously owned by global_map. Note: when empty_map runs out of scope it releases the big block.
// This trick works with other stl container types too.
Why mix std::strings and MFC CStrings? And yes, the memory used to store the map's contents is freed since the map will handle destructing its contents and the contents don't require any manual cleanup.