how to fix bug due to a heap corruption
I have the following callstak when my application crash (create via MSVC210 save dump feature and winbdg in a second time with k command):
0012c720 7d684c89 0012c93c 7d656a16 063acab8 ntdll!DbgBreakPoint
0012c728 7d656a16 063acab8 0000035c 035f0000 ntdll!RtlpBreakPointHeap+0x28
0012c93c 7d685892 035f0000 50000161 0000035c ntdll!RtlAllocateHeapSlowly+0x231
0012c9b0 7d65695e 035f0000 50000161 0000035c ntdll!RtlDebugAllocateHeap+0xaf
0012cbcc 7d62ba89 035f0000 40000060 0000035c ntdll!RtlAllocateHeapSlowly+0x41
0012cdfc 10308343 035f0000 40000060 0000035c ntdll!RtlAllocateHeap+0xe9f
0012ce14 1031697c 0000035c c8fa7bd5 0012deb0 MSVCR100D!_heap_alloc_base+0x53
0012ce5c 1031671f 00000338 00000001 00000000 MSVCR100D!_nh_malloc_dbg+0x2dc
0012ce7c 103166cc 00000338 00000000 00000001 MSVCR100D!_nh_malloc_dbg+0x7f
0012cea4 10319c5b 00000338 00000000 00000001 MSVCR100D!_nh_malloc_dbg+0x2c
0012cec4 10307db1 00000338 04f26388 0012cfac MSVCR100D!malloc+0x1b
0012cee0 65302a58 00000338 c8876569 00000070 MSVCR100D!operator new+0x11
It seems this is due to a heap corruption.
I don't know how or what look for in my code to fix the bug..
Is there any best practices to fix this king og bug ?
Thanks a lot
Heap corruption can be due to a number of reasons and it is hard to detect such code through code analysis. The best possible way is to:
Run your code through Valgrind or Rational Purifyplus or any such memory analysis tools they shall help you determine what is exactly wrong and will point it out to you.
Have a look at:
How to debug heap corruption errors?
to know about other memory analysis tools you can use.
链接地址: http://www.djcxy.com/p/82310.html上一篇: 如何调试非确定性访问冲突崩溃?
下一篇: 如何修复由于堆损坏导致的错误