I've been using the various _CRTMem* functions to attempt to locate memory leaks in our code. The application is an unmanaged C++ appplication. Some strange things I've noticed:
- There is a huge discrepance between the increase in memory use reported by Task Manager (I use its "Commit Size" metric), and that reported by using the CRT Heap Debugger functions _CrtMemCheckpoint(), _CrtMemDifference() and _CrtMemDumpStatistics(). The reported memory use increase is 200KB (Task Manager) vs 17 KB (CRT heap debugger). Can it be that windows is allocating extra memory in the background? It seems like a huge discrepancy.
- I've been using the _CRTDBG_MAP_ALLOC #define and the function _CrtMemDumpAllObjectsSince() to get memory leak file locations. However, about 75% of the leaks don't have file location information available. Does this also indicate that extra allocations are occuring behind the scenes.
We test using Windows 7, but the final destination application will run unders Windows CE. Does WindowsCE have better (or different) memory management?
Can anyone help? Many thanks, Paul