Microsoft KB Archive/907289

= An ATL-based application may unexpectedly close when the ATL project redefines the HeapAlloc function in Visual C++ 2005 =

Article ID: 907289

Article Last Modified on 3/1/2006

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition

-





SYMPTOMS
Consider the following scenario. You create a Microsoft Active Template Library (ATL) project in Microsoft Visual C++ 2005. The ATL project redefines the HeapAlloc function to redirect to a different custom function. In this scenario, the ATL application may unexpectedly close.

You may experience this problem when you use a line of code that is similar to the following: Note This problem may also occur when you use the HeapCreate, HeapDestroy, HeapFree, and HeapReAlloc functions.
 * 1) define HeapAlloc MyHeapAllocator



CAUSE
This problem occurs because the ATL feature in Visual Studio 2005 undefined the definitions for some memory management functions, such as the HeapAlloc function. The following line of code is in the ATL header files and undefines a custom definition of HeapAlloc:
 * 1) undef HeapAlloc



WORKAROUND
To work around this problem, make sure that you include the ATL header files before you include a custom definition for the HeapAlloc function.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
For more information about ATL features in Visual Studio 2005, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/ms235433(vs.80).aspx

Additional query words: ATL HEAPALLOC

Keywords: kbinfo kbtshoot kbnofix kbprb KB907289

-

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

© Microsoft Corporation. All rights reserved.