468,720 Members | 1,884 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

memory leak

GJ
Hi,

Can we trace a memory leak in a C++ program without using any specific tools
like purifier.

--
GJ

Oct 26 '05 #1
2 1758
* GJ:

Can we trace a memory leak in a C++ program without using any specific tools
like purifier.


It's a lot easier to use appropriate tools, so why not?

Otherwise you'll have to instrument your whole application, i.e. recompile
with 'new' replaced with something that keeps track of where and when. A
simple replacement of global operator new can't do that because it doesn't
know. So we're then talking about e.g. #define new as something else, as was
done in e.g. old MFC (with disastrous consequences, they forgot to redefine
delete accordingly, which meant a debug build would leak memory if any
constructor threw an exception).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Oct 26 '05 #2

Alf P. Steinbach wrote:
* GJ:

Can we trace a memory leak in a C++ program without using any specific tools
like purifier.


It's a lot easier to use appropriate tools, so why not?

Otherwise you'll have to instrument your whole application, i.e. recompile
with 'new' replaced with something that keeps track of where and when. A
simple replacement of global operator new can't do that because it doesn't
know. So we're then talking about e.g. #define new as something else, as was
done in e.g. old MFC (with disastrous consequences, they forgot to redefine
delete accordingly, which meant a debug build would leak memory if any
constructor threw an exception).


Alf, Could you please define "old MFC" in terms of Visual C++ version?

Cheers! --M

Oct 26 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by ranjeet.gupta | last post: by
17 posts views Thread by Josť Joye | last post: by
4 posts views Thread by Don Nell | last post: by
20 posts views Thread by jeevankodali | last post: by
23 posts views Thread by James | last post: by
8 posts views Thread by Adrian | last post: by
7 posts views Thread by Salvador | last post: by
3 posts views Thread by Jim Land | last post: by
7 posts views Thread by Ragnar Agustsson | last post: by
22 posts views Thread by Peter | last post: by
1 post views Thread by CARIGAR | last post: by
9 posts views Thread by bryonone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.