Re: Can't get debug heap working
- From: "Alex Blekhman" <xfkt@xxxxxxxxx>
- Date: Sat, 10 Mar 2007 18:18:28 +0200
<jmagnuss@xxxxxxxxx> wrote:
These are the CObject operator new declarations,
--- CUT ---
#if defined(_DEBUG) && !defined(_AFX_NO_DEBUG_CRT)
// for file name/line number tracking using DEBUG_NEW
void* PASCAL operator new(size_t nSize, LPCSTR lpszFileName, int
nLine);
#if _MSC_VER >= 1200
void PASCAL operator delete(void *p, LPCSTR lpszFileName, int nLine);
#endif
#endif
--- CUT ---
I'm not really sure why my
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
is conflicting with these, and I have confirmed that _DEBUG is defined
just before the allocation I describe in my previous post.
Probably using the same name ("new") in your macro confuses preprocessor somehow. I always give different names:
// in .H file
#if defined(_DEBUG)
# define DEBUG_NEW new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
# define DEBUG_NEW
#endif // _DEBUG
// in .CPP files
#if defined(_DEBUG)
# define new DEBUG_NEW
#endif // _DEBUG
However, if you use MFC, then you don't need to do anything, since MFC already has all necessary defines in order to track `CObject' based objects.
Alex
.
- References:
- Can't get debug heap working
- From: jmagnuss
- Re: Can't get debug heap working
- From: Ben Voigt
- Re: Can't get debug heap working
- From: jmagnuss
- Re: Can't get debug heap working
- From: jmagnuss
- Can't get debug heap working
- Prev by Date: Re: Using directive/declaration and the global namespace
- Next by Date: Re: Logging all memory allocations?
- Previous by thread: Re: Can't get debug heap working
- Next by thread: Re: Can't get debug heap working
- Index(es):
Relevant Pages
|