0

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

trincot
  • 317,000
  • 35
  • 244
  • 286
Guillaume Paris
  • 10,303
  • 14
  • 70
  • 145

1 Answers1

5

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.

Community
  • 1
  • 1
Alok Save
  • 202,538
  • 53
  • 430
  • 533
  • the problem is that Purifyplus will very decrease performance of my application which turn in production in a high speed constraing environement – Guillaume Paris Dec 22 '11 at 16:38
  • @Guillaume07: If your code is doing something funny these memory analysis tools will be able to detect it even if not the production environment.Also, this is only for detecting the bug and fixing it preferably on a debug version and not for release version. – Alok Save Dec 22 '11 at 16:41
  • Thanks a lot for the link "How to debug heap corruption errors?" ! – Guillaume Paris Dec 22 '11 at 16:41
  • But maybe in dev the code which cause the Application to crash will no be executed, because not cover by the different actions I will do in dev – Guillaume Paris Dec 22 '11 at 16:43
  • @Guillaume07: If I were you and I was desperate to track down the bug I would take the chance of trying it out given that the probability of tools finding the bug is high. – Alok Save Dec 22 '11 at 16:45