c++ - Using CRT Library to find specific memory leaks -
i following msdn article finding memory leaks using crt.
http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.100%29.aspx
i added _crtdumpmemoryleaks(); exit point of application. shows me thousands of memory leaks in different files. interested in finding memory leaks of particular file/class/function. there possible way implement this.
here tried do.
void someclass::somerandomfunction(somerandomparameters) { _crtdumpmemoryleaks(); // start of function. // lines of codes may contain memory leaks. _crtdumpmemoryleaks(); // end of function. }
i added breakpoints on entry , exit of method. thought second dumpmemory function display memory leaks find between these 2 dumpmemory function calls. didn't happened. there other way this?
_crtdumpmemoryleaks() should ever used @ end of program. looking _crtmemcheckpoint(), call @ start of function take snapshot. , use _crtmemdumpallobjectssince() @ end of function see what's allocated since snapshot not released. careful, might not leaks when make fine-grained.
Comments
Post a Comment