The information in this article applies to:
SYMPTOMSWhen you call the delete operator or free() function in an ATL project, it might cause an access violation if you are running on a multi-processor computer. CAUSEATL provides an implementation of free() in non-debug builds with _ATL_MIN_CRT defined. The delete operator is also overridden to call free(). On multi-processor computers, the pointer passed in to free() is used to calculate an offset to the heap's handle:
There is no code here that checks if "p" is NULL; therefore, so HeapFree()
is called with an invalid handle.
RESOLUTIONThe implementation of free() needs to be modified in Atlimpl.cpp. One option to resolve this problem is to just return if the pointer is NULL:
Another option to resolve this problem is to #define _ATL_NO_MP_HEAP. This
prevents the problematic code from being included. However, this does turn
off the optimization that ATL adds for multi-processor machines. You have
only one heap regardless of the number of processors. Heap access may be
less than optimal because access from multiple threads is serialized.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base: MORE INFORMATIONThis bug occurs only under all of the following conditions:
Additional query words: unhandled exception new malloc memory
Keywords : kbservicepack kbCRT kbVC600bug kbATL300bug kbVS600sp2 kbVS600SP1 kbVS600sp3fix kbGrpMFCATL |
Last Reviewed: November 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |