Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/articles/c-tutorials/)
-   -   Memory Leak detection Program without using any tools (http://www.go4expert.com/articles/memory-leak-detection-program-using-t9133/)

rahul.mca2001 6Mar2008 12:54

Re: Memory Leak detection Program without using any tools
 
i tried and it really works well

bashamsc 7Mar2008 15:48

Re: Memory Leak detection Program without using any tools
 
Nice program to detect memory leak. But i want to know how to recover the memory after memory leak and how to prevent it.

asadullah.ansari 7Mar2008 19:48

Re: Memory Leak detection Program without using any tools
 
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.

shabbir 9Mar2008 10:58

Re: Memory Leak detection Program without using any tools
 
bubyfound, Make sure we discuss only in English.

debleena_doll2002 10Mar2008 11:06

Re: Memory Leak detection Program without using any tools
 
Quote:

Originally Posted by shabbir
bubyfound, Make sure we discuss only in English.

I am unable to get yout statement. shabbir, Please Can you use QUOTE so that we can easily identify.

shabbir 10Mar2008 11:48

Re: Memory Leak detection Program without using any tools
 
bubyfound, had one post in non-English and so its directed to him. I have not quoted his non-english posts

rashida.par 10Mar2008 11:48

Re: Memory Leak detection Program without using any tools
 
very nice article

donakalz 21Mar2008 23:06

Re: Memory Leak detection Program without using any tools
 
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

donakalz 24Mar2008 16:54

Re: Memory Leak detection Program without using any tools
 
Wow. So quiet in here. Hello? Anybody here?

lead.smart34 25Mar2008 15:17

Re: Memory Leak detection Program without using any tools
 
really a very nice code


All times are GMT +5.5. The time now is 15:59.