Why memory consumed by a VS2015 ATL+MFC application increases constanly?
Hi, buddies,
We have just upgraded an old ATL+MFC application to VS2015/Win7/Win10 Environment. However, we encountered a memory problem, that is, along the running time increased, the consumed memory also increases constantly. We logged memory used
by our own objects, there is no big change which means there is no memory leak in these objects. Moreover, in debug mode, even we free all user objects, the application still consumes a lot of memory.
For example, when we start the application, it uses about 30MB memory, then user objects are created, the total memory increases to 150MB. Then we try to close the application, first we free the user objects, the application uses 30MB memory
before it is totally closed. This implies that the application framework may use 30MB memory. However, after 3-4 days running, the application use about 200MB memory, and when we try to close it, after freeing 120MB memory used by user objects, we found the
application still occupied about 80MB memory. Why the memory used by application framework increased from 30MB to 80MB? In both case, when the application is stopped, there is no memory leak detected in VS2015. And, we are sure there is no memory leak with
our user objects.
The application worked well with old environment (VS6.0). I suspected that the CString class in VS2015, which is rewritten using ATL::StringT.
Moreover, we did try the release version to check whether there is no memory problem. But, we got worse result: the application could not even work correctly. Randomly, exception occurred when a CString object is assigned to another Cstring
object. This is so strange, there is no such problem in debug version.
Urgent for us, thanks !
Kevin