By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,443 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,443 IT Pros & Developers. It's quick & easy.

memory leak

P: n/a
GJ
Hi,

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

--
GJ

Oct 26 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* 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

P: n/a

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.