[英]Debugging HeapReAlloc failure using GetExceptionCode
Been messing about with this all day and haven't got anywhere so I'm hoping someone can help me - I have a HeapReAlloc method failing with the error ACCESS_VIOLATION, but I'm unsure how to implement a further check using GetExceptionCode as it uses try/catch or exception or something - can someone give me a quick example of how I can use it to narrow down this failure, please? 一整天都在忙着解决这个问题,所以我希望有人可以帮助我-我有一个HeapReAlloc方法因错误ACCESS_VIOLATION而失败,但是我不确定如何使用GetExceptionCode实现进一步的检查尝试/捕获或异常之类的东西-有人可以给我一个简短的示例,说明如何使用它来缩小此失败的范围吗?
Thanks very much, Becky 非常感谢,贝基
You are trouble-shooting the wrong problem. 您正在解决错误的问题。 HeapRealloc() is bombing because the heap is corrupted.
HeapRealloc()正在轰炸,因为堆已损坏。 That happened a while ago, some statement in your program overflowing a heap block, writing data to memory that was freed, something like that.
那是在不久前发生的,程序中的某些语句溢出了一个堆块,将数据写入已释放的内存,类似的事情。 MSVC has a debug memory allocator to help you troubleshoot these kind of problems, look in the MSDN library for
<crtdbg.h>
. MSVC具有调试内存分配器,可帮助您解决此类问题,请在MSDN库中查找
<crtdbg.h>
。
Are HeapReAlloc
's hHeap
and lpMem
valid? HeapReAlloc
的hHeap
和lpMem
有效吗? What value are you passing for dwFlags
? 您为
dwFlags
传递了什么价值? Did you obtain hHeap
via HeapCreate
or GetProcessHeap
? 您
hHeap
通过HeapCreate
或GetProcessHeap
获得hHeap
? What parameters have you provided to HeapCreate
/ GetProcessHeap
? 您为
HeapCreate
/ GetProcessHeap
提供了哪些参数?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.