The _CRTDBG_MAP_ALLOC macro does not work as expected (140858)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q140858 SYMPTOMS
When an object is allocated through use of the New operator and dumped
through use of the debugging routines in the C Run-Time Library, the
allocation is reported as occurring in the Crtdbg.h file line 512.
CAUSE
This is caused by the definition of the overloaded operator New in the
Crtdbg.h file:
#ifdef _CRTDBG_MAP_ALLOC
inline void* __cdecl operator new(unsigned int s)
{ return ::operator new(s, _NORMAL_BLOCK, __FILE__, __LINE__); }
#endif /* _CRTDBG_MAP_ALLOC */
Here __FILE__ and __LINE__ are macros defined by the compiler that report
the current file name and line number. Macros are filled out by the
preprocessor. Then the compiler replaces your call to New with this
function. Therefore, the macros have already been filled out before they
are inlined. Hence they will report the header file information.
| Modification Type: | Major | Last Reviewed: | 6/2/2005 |
|---|
| Keywords: | kbtshoot kbdocerr kbprb KB140858 kbAudDeveloper |
|---|
|