0

The aim of my application is to cancel noise. When I run continuously and observe the memory usage using Process Explorer, I notice that the Private Bytes increase slowly for example from 11.8 MB to 13 MB and so on.

A colleague of mine told me that it goes up to 1 GB and the application crashes.

How can I solve this issue? I have written this application in C++.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
chintan s
  • 6,170
  • 16
  • 53
  • 86
  • Search for a plugin call "Memory Leak Detector" – Twifty Jul 22 '13 at 15:09
  • You need to keep under control the memory your data structures are using and deleting unnecessary data that are in the memory. Reaching from few MB to 1GB is kinda big deal – kkanellis Jul 22 '13 at 15:10
  • 1
    @RanEldan I've heard of valgrind, but not valingaurd. – Borgleader Jul 22 '13 at 15:12
  • @Borgleader spelling mistake – Ran Eldan Jul 22 '13 at 15:18
  • Thanks for all the replies. I will try Valgrind. In fact, we have use Coverity and I have solved all the issues pointed out by Coverity. – chintan s Jul 22 '13 at 15:24
  • Note that none of the measures you see Process Explorer can reliably tell you if you have a resource leak. See the first answer to this question: http://stackoverflow.com/questions/1984186/what-is-private-bytes-virtual-bytes-working-set?rq=1 – Adrian McCarthy Jul 22 '13 at 15:43

2 Answers2

0

There's no quick fix for this, especially in C++ memory maintenance is something you have to practice throughout the development process, not slap on at the end. And since it could be virtually anywhere in your code (no pun intended), it's not really practical to post code here.

My only advice is to look for use of the new operator, and make sure that there is an accompanying delete. Also using unit tests on your classes/functions/etc. can help narrow down the problem.

Good luck.

Pat Lillis
  • 1,152
  • 8
  • 19
0

You can take `UMDH´ from the "Debugging Tools for Windows". With this, you can use the build-in support from Windows to find memory leaks.

For more info see Using UMDH to Find a User-Mode Memory Leak

See also: UMDH (Windows Debuggers

You need to download the Debugging Tools for Windows with the SDK or DDK. You also can download an older version from the MSDN Archive, which should be sufficient to use UMDH.

Jochen Kalmbach
  • 3,549
  • 17
  • 18