How is MFC app commiting to virtual memory?

196 Views Asked by At

I am working on an MFC app that seems to be automagically committing to ~160MB of virtual memory. The app typically runs at 10-14MB of memory usage so this level of committed memory seems excessive. Additionally there is no where in the code where VirtualAlloc is called... COM & ATL are also being used.

The memory shows as committed the instance the process launches, before a breakpoint in __tmainCRTStartup can be reached.

How can this memory be reserved/committed?

Thanks in advance!

2

There are 2 best solutions below

0
On BEST ANSWER

Turned out there was some "legacy" code using a static array of custom objects that allocated around 1000 extra elements, so changing this to use a std::vector alleviated this issue completely...

1
On

The only reason can be a DLL you use. I've used MFC 7.0 and 9.0 for many projects and can tell you that they don't commit this lot of memory.