Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a small memory leak detection in C++?

I am trying to write a small memory leak detection tool.

My idea is to track the dynamic memory allocation life with in my application to determine any invalid access of memory or un deleted memory which might cause my application to core over a time of use.

I want to write a simple interface to override new and delete.

And in my overridden new i wanted to print function line address etc. And then call the standard new.

Have anyone already tried this? I am not sure whether i can call standard new from my class specific new operator.

like image 979
linux developer Avatar asked Nov 12 '22 17:11

linux developer


1 Answers

There's a couple of articles here:

http://www.codeproject.com/Articles/8448/Memory-Leak-Detection

http://www.codeproject.com/Articles/19361/Memory-Leak-Detection-in-C

http://www.codeproject.com/Articles/9815/Visual-Leak-Detector-Enhanced-Memory-Leak-Detectio

http://www.codeproject.com/Articles/393957/Cplusplus-Memory-Leak-Finder

like image 126
Software_Designer Avatar answered Nov 15 '22 12:11

Software_Designer