Nice program to detect memory leak. But i want to know how to recover the memory after memory leak and how to prevent it.
This program will tell you 1. line number 2. source file name 3. starting address 4. total bytes . If this is your program then go to that line and call free function for that pointer which is pointing to memory and not deallocated. If that is not your program means it may be in binary then You have four information by running this program , then take a pointer which will point to constant address as above 3. and set the offset as required based on as above 4 info. then call free function for this pointer.
bubyfound, had one post in non-English and so its directed to him. I have not quoted his non-english posts
Thanks man for the very very nice code. However, I am trying to create a version which works for C++ operators new and delete like this: #define new (elemSize) MyNew (elemSize, __FILE__, __LINE__) #define new [](elemSize) MyNewArray (elemSize, __FILE__, __LINE__) #define delete(memPointer) MyDelete (memPointer) #define delete [](memPointer) MyDeleteArray (memPointer) and I get the following compiler errors: 24:1 [Warning] "new" redefined 26:1 [Warning] "delete" redefined Can you think of a workaround for this? Thanks. Don
How it will happen? Are You sure about this warning? Because I am using Flexlint tools for making zero warning also. By any way can you give at which plateform and compiler you are using ?
I use windows xp and a DevC++ compiler. I get the error that new and delete are redefined. I also get the error with Netbeans 6.1 for C++. Maybe you could post some code of yours to show how you accomplished this task. Thanks. don
I dont know how you are using. Have you some sense. Any compiler is not mad like you. How it will give redefined. I have define as macro. Do you have some skill. If you have some little bit skill then it will run.
Hi Aa I saw through this forum many people are asking basic question what is memory leak and they are advised to go through google.Can any do a little favour like when creating any variable or ointer things in which area of memory it stores(i mean to say like code segment ,data seg etc).Explanation (undestanding)required on it before going about memory leak
Hello asadullah, Could you please send the findleak program for C++ for New, Delete .. methods? Thanks, INDRA