0
rahul.mca2001's Avatar, Join Date: Feb 2008
Ambitious contributor
i tried and it really works well
0
bashamsc's Avatar, Join Date: May 2007
Go4Expert Member
Nice program to detect memory leak. But i want to know how to recover the memory after memory leak and how to prevent it.
0
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
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.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
bubyfound, Make sure we discuss only in English.
0
debleena_doll2002's Avatar
Ambitious contributor
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.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
bubyfound, had one post in non-English and so its directed to him. I have not quoted his non-english posts
0
rashida.par's Avatar, Join Date: Feb 2008
Go4Expert Member
very nice article
0
donakalz's Avatar, Join Date: Mar 2008
Newbie Member
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
0
donakalz's Avatar, Join Date: Mar 2008
Newbie Member
Wow. So quiet in here. Hello? Anybody here?
0
lead.smart34's Avatar, Join Date: Feb 2008
Contributor
really a very nice code