2

I have an application developed in VC 2008 (C++) which uses axis dlls, which use openssl dlls. And someone in the chain corrupts heap - a situation which ends up giving me "memory access violation" in my application in places where violation shouldn't/couldn't happen. So, someone in the chain axis-ssl corrupts something, but I cannot find who or what.

I tried using DevPartner's tool for memory leaks, but it finds no leaks - no anything.

How should I approach this problem? I looked over axis and ssl documentation a number of times, and implemented and checked all possible memory management issues and fixes, but to no avail.

Thank you very much! Marin

Marin
  • 1,311
  • 16
  • 35
  • 1
    Are you sure, it is not your own code ? Libraries do get checked for these type of issues before release. – DumbCoder Dec 14 '10 at 13:18
  • Do you have a stack trace of when the error happens? You may try windbg for that. – Juraj Blaho Dec 14 '10 at 13:23
  • Have a look at this question: http://stackoverflow.com/questions/413477/is-there-a-good-valgrind-substitute-for-windows . It doesn't answer your question directly, but there is a lot of good tools mentioned. – Sergei Tachenov Dec 14 '10 at 14:20
  • Did you try cleaning and recompiling? Occasionally I had access violations in VC and they where caused by some old object files which where not automatically recompiled. Also some mismatch in project settings between my software and libraries also gave access violations. – rve Dec 14 '10 at 14:25

4 Answers4

3

Try using MS application verifier. It integrates with Visual Studio, so you can make "verified" run directly from it.

Kirill Kovalenko
  • 2,121
  • 16
  • 18
3

Why do you think a leak could be somehow responsible for a corruption? You'd need to watch out for out-of-bounds access, dead pointer access, illegal casts and things like that, not for a leak. It's a tricky thing to do. Valgrind is a great tool for chasing this sort of issues, but unfortunately it's not available for Win32. If your code is portable, you could try debugging it on Linux, otherwise you'd either need to use commercial tools like Purify, or do it the good old way, with a help of logging and assertions, and a debugger of course.

SK-logic
  • 9,605
  • 1
  • 23
  • 35
2

If you get the debug versions of the libraries, MSVC offers a debug malloc and free, as well as a debug new and delete. These contain things like overwrite detection.

http://msdn.microsoft.com/en-us/library/bebs9zyz.aspx

Puppy
  • 144,682
  • 38
  • 256
  • 465
  • tried it, but I get no output from them, all I get is First-chance exception at 0x0066ca60 in CardTerminalDesktopApplication.exe: 0xC0000005: Access violation reading location 0x0173613c. Unhandled exception at 0x0066ca60 in CardTerminalDesktopApplication.exe: 0xC0000005: Access violation reading location 0x0173613c. once it already crashes. – Marin Dec 14 '10 at 14:27
  • 1
    I managed to get valid response, and yes - I get leaks! But output is deprecated, something like: {145} normal block at 0x007F7328, 64 bytes long. Data: 46 3A 5C 44 6F 63 75 6D 65 6E 74 73 20 61 6E 64 .... how can I get a more informative output? I defined #define _CRTDBG_MAP_ALLOC... – Marin Dec 14 '10 at 14:42
1

May be this MSDN article might have the answers you are looking for: Finding a Memory Leak

Also you could try this LeakDiag tool. Not sure as to why there is no reference to it in MSDN?!?!? But there is a neat article in Codeproject.com

yasouser
  • 5,113
  • 2
  • 27
  • 41