_CrtIsValidHeapPointer(pUserData)可能的原因(转)
2010-01-07 18:40
411 查看
I read the dbgheap.c and find the line 1132, it's as follows:
/*
* If this ASSERT fails, a bad pointer has been passed in. It
may be
* totally bogus, or it may have been allocated from another
heap.
* The pointer MUST come from the 'local' heap.
*/
1132: _ASSERTE(_CrtIsValidHeapPointer(pUserDat
a));
I also use google to find some answers.
They said
(1) If you are developing multithread application, be sure to link it
with the correct runtime library(/MD, /MT). That what
"The pointer MUST come from the 'local' heap." means.
Check what "ruintime library" you use. It should be "Multi threaded (
debug ) DLL"
(2)
Not only must they match, they must both be DLL versions. If they're
static versions, each piece (the exe and the dll) will have their own
heap and the OP will still be deleting from mismatched heaps.
I'd also be suspicious of general design issues given the way the OP's
main program is having to clean up for the dll.
You'll get this problem if you use two different run-time libraries,
one to allocate the memory and one to de-allocate the memory. Open up the
project settings dialog, switch to C/C++ tab, set Category to Code Generation and check the Use run-time library combo box. These must match in any modules that share the task of allocating and destroying memory.
/*
* If this ASSERT fails, a bad pointer has been passed in. It
may be
* totally bogus, or it may have been allocated from another
heap.
* The pointer MUST come from the 'local' heap.
*/
1132: _ASSERTE(_CrtIsValidHeapPointer(pUserDat
a));
I also use google to find some answers.
They said
(1) If you are developing multithread application, be sure to link it
with the correct runtime library(/MD, /MT). That what
"The pointer MUST come from the 'local' heap." means.
Check what "ruintime library" you use. It should be "Multi threaded (
debug ) DLL"
(2)
Not only must they match, they must both be DLL versions. If they're
static versions, each piece (the exe and the dll) will have their own
heap and the OP will still be deleting from mismatched heaps.
I'd also be suspicious of general design issues given the way the OP's
main program is having to clean up for the dll.
You'll get this problem if you use two different run-time libraries,
one to allocate the memory and one to de-allocate the memory. Open up the
project settings dialog, switch to C/C++ tab, set Category to Code Generation and check the Use run-time library combo box. These must match in any modules that share the task of allocating and destroying memory.
相关文章推荐
- VS调试程序_ASSERTE(_CrtIsValidHeapPointer(pUserData))崩溃的原因以及解决方法
- VS调试错误_ASSERTE(_CrtIsValidHeapPointer(pUserData))
- VS调试错误_ASSERTE(_CrtIsValidHeapPointer(pUserData))
- Expression: _CrtIsValidHeapPointer(pUserData)
- Expression: _CrtIsValidHeapPointer(pUserData)
- [转] 调试错误 ASSERTE(_CrtIsValidHeapPointer(pUserData))
- _CrtIsValidHeapPointer(pUserData)奇怪的问题?
- Expression: _CrtIsValidHeapPointer(pUserData)
- 调试错误 ASSERTE(_CrtIsValidHeapPointer(pUserData))
- _ASSERTE(_CrtIsValidHeapPointer(pUserData))错误详解
- C++/CLI程序启动时_CrtIsValidHeapPointer(pUserData)错误
- delete释放内存,发生错误,显示DBGHEAP.C中的_ASSERTE(_CrtIsValidHeapPointer(pUserData))
- Expression: _CrtIsValidHeapPointer(pUserData) 问题!
- mfc _CrtIsValidHeapPointer(pUserData) 异常出现
- _ASSERTE(_CrtIsValidHeapPointer(pUserData))错误详解
- C++/CLI程序启动时_CrtIsValidHeapPointer(pUserData)错误
- _CrtIsValidHeapPointer(pUserData)
- vs调试报错:“_ASSERTE(_CrtIsValidHeapPointer(pUserData)) ”的问题解决
- C++/CLI程序启动时_CrtIsValidHeapPointer(pUserData)错误
- _CrtIsValidHeapPointer(pUserData) 问题解决