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/)

sareen 25Mar2008 15:39

Re: Memory Leak detection Program without using any tools
 
nice

sareen 25Mar2008 15:44

Re: Memory Leak detection Program without using any tools
 
sir very easy program

asadullah.ansari 26Mar2008 14:55

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

Originally Posted by donakalz
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 ?

donakalz 27Mar2008 04:11

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

asadullah.ansari 28Mar2008 10:40

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

Originally Posted by donakalz
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.

shabbir 4Apr2008 18:45

Re: Memory Leak detection Program without using any tools
 
Nomination for article of the month of March

shabbir 17Apr2008 15:51

Re: Memory Leak detection Program without using any tools
 
Vote here - Voting for article of the month for Mar 2008

shabbir 30Apr2008 12:00

Re: Memory Leak detection Program without using any tools
 
Winner of article of the month for Mar 2008

saroj.pandarkl 21Jun2008 16:16

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

inkuar.ikkr 24Jun2008 22:31

Re: Memory Leak detection Program without using any tools
 
Hello asadullah,

Could you please send the findleak program for C++ for New, Delete .. methods?

Thanks,
INDRA


All times are GMT +5.5. The time now is 19:58.