Does getting random SIGTRAP signals (in MinGW-gdb) is a sign of memory corruption?

后端 未结 2 1617
梦毁少年i
梦毁少年i 2021-01-05 16:48

I wrote my own reference counted memory manager c++ (for fun) and I\'m sure it isn\'t perfect ;) . And now when I\'m trying to use it I got random SIGTRAP signals. If I comm

2条回答
  •  情书的邮戳
    2021-01-05 16:51

    After searching on Google I realized that those sigtraps are same as those warnings you get in MSVC++ saying "Windows has triggered a breakpoint in xxxx.exe. This may be due to a corruption of the heap, and indicates a bug blahblahblah"...

    So it seems yes, unexpected sigtraps can indicate memory corrupction (quite strange...)

    And I found my bug too. The MM is in a static library which is linked to a dll. And that static lib and the dll is linked to my exe. So there were two memory managers, one in my exe and one in my dll. If call the initaialization method of the MM. It initialized the MM in my exe but not in the dll so the dll went without init. I solved this by not linking my exe against that static library.

提交回复
热议问题