Why memory consumed by a VS2015 ATL+MFC application increases constanly?

weixin_38051538 2017-07-29 01:39:58
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

...全文
31 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复

476

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧