Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory leak debugger

Status
Not open for further replies.

jayjay60

Programmer
Jun 19, 2001
97
0
0
FR
Hi everybody,

I would like to know if someone could tell me if a debugger made to find memory leak problem exist for windows environment & if it's ok where i could find it? Some of my friends tell me about a software called "valgrind" which only works under linux environment!

Thanks in advance for yours answers

jayjay
 
You can try overloading the new and delete operators and monitoring them to see how many times you allocate then deallocate memory. if the numbers dont match u know uve got a mem leak.

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
The Visual C++ debugger will tell you of undeleted blocks of memory, with a preview of it's content and where it was allocated, if it knows it. (It will not know if part of your code is in release mode, e.g. in a DLL or something.)

This information is displayed in the "Debug" pane, after you exit your program normally.

Vincent
 
There is information in the MSN files on extending the debugger memory information, and there are additional applications that plug into Vis Dev that give real power to memory debugging (post back to remind me and I'll give you the name when I go back to work, but theyre not cheap.

The cheapsest (and most time consuming method) is to search your program, and look for new statements. Check each new has an associated delete, and each new that allocates an array has an associated delete[]

things that have caught me out in the past are singletonpatterns, and inappropriate use of ptr=NULL

if you have an ap with memory leaks, the best thing to do is to identify which class is causing it (you can sometimes do so from the info in the output pane, else it's a case of commenting out functions and seeing if the number of leaks caused has dropped. If so, then you know that there is 1 or more in that fn.

Ask if you need more help, or if this is garbled,
K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top