Microsoft KB Archive/141958

= FIX: _CRTDBG_MAP_ALLOC Environment Var References Incorrect =

Article ID: 141958

Article Last Modified on 12/2/2003

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription

 Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q141958

<div class="symptoms_section">

SYMPTOMS
There are several incorrect references to setting the _CRTDBG_MAP_ALLOC environment variable in the documentation for the debug version of the C run-time library.

It is not an environment variable, but rather a preprocessor constant. This symbol needs to be defined either in the code with a #define or from the command line with the compiler /D option.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
If you look in the header file, Crtdbg.h, you will see that this symbol is used as a preprocessor constant.

There are two places where this symbol is referred to as an environment variable in the Run-Time Library Reference. From the Help contents, go to "Debug Version for the Run-Time Library" in the Run-Time Library Reference book, go to "Memory Management and the Debug Heap" and then "Using the Debug Version Versus the Base Version." The second sentence in the third paragraph states, "Applications that do not want to convert their malloc calls to _malloc_dbg can obtain the source file information by defining the _CRTDBG_MAP_ALLOC environment variable." In the next paragraph, it also states, "When _DEBUG is not defined, calls to malloc are not disturbed, calls to _malloc_dbg are resolved to malloc, the _CRTDBG_MAP_ALLOC environment variable is ignored, ..."

Keywords: kbbug kbfix kbcrt kbvc600fix kbdocs KB141958

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.