0

We have an 64-bit application that runs in c++ code in 16gb ram windows virtual machine. After few days of running the application,whole Pagefile.sys memory(32 GB) got filed and leads to crash.In resource monitor

  • Commit(KB): 22 643 396

  • Working Set (KB): 982 208

If it is memory leak why it doesn't showing growth in Working set memory ? I would also like to know in what situations, only commit memory will grow greater than working set memory? What tools for c++ we can use to identify the root cause for this problem?

I understand that commit size includes RAM used and Virtual memory. please explain why virtual memory used not able to deallocate even process in idle state?

Note:-In this application no virtualAlloc() has used only c++ new operator has been used.

  • 2
    The OS limits the working set size. Also the working set are the pages in physical memory not swap. Related: [https://learn.microsoft.com/en-us/windows/win32/memory/working-set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set) – drescherjm Feb 16 '21 at 18:16
  • yes i think it is ram size and machines ram size is 16 gb ram in the above case.why commit is growing a lot. – Jagadeesh Boggarapu Feb 16 '21 at 18:20
  • Here is one program that may help you find the leak: [https://marketplace.visualstudio.com/items?itemName=ArkadyShapkin.VisualLeakDetectorforVisualC](https://marketplace.visualstudio.com/items?itemName=ArkadyShapkin.VisualLeakDetectorforVisualC) – drescherjm Feb 16 '21 at 18:32
  • Here is a paid software that does similar but is more advanced: [https://www.softwareverify.com/cpp-memory.php](https://www.softwareverify.com/cpp-memory.php) I used to have a license for this but it expired and we did not pay for renewal so I have not used it in a very long time. – drescherjm Feb 16 '21 at 18:33
  • There are other products like this: [https://www.teamblue.unicomsi.com/products/purifyplus/](https://www.teamblue.unicomsi.com/products/purifyplus/) – drescherjm Feb 16 '21 at 18:37
  • And then there is also valgrind – drescherjm Feb 16 '21 at 18:37
  • Related: [https://stackoverflow.com/questions/4790564/finding-memory-leaks-in-a-c-application-with-visual-studio](https://stackoverflow.com/questions/4790564/finding-memory-leaks-in-a-c-application-with-visual-studio) – drescherjm Feb 16 '21 at 18:38
  • 1
    ***please explain why virtual memory used not able to deallocate even process in idle state?*** A native c++ application (which you tagged for) does not garbage collect at all so no background cleanup happens at Idle. – drescherjm Feb 16 '21 at 19:03
  • yes in c++ application there will be no gargabe collector , so do you think the memory in commit is all leaked memory? – Jagadeesh Boggarapu Feb 17 '21 at 06:05
  • I would also like to know , Is there any difference in memoryleak in pagfile.sys and memoryleak in physical ram ? – Jagadeesh Boggarapu Feb 17 '21 at 08:48

0 Answers0