How to troubleshoot crashes in malloc

后端 未结 3 687
孤街浪徒
孤街浪徒 2020-12-12 05:32

I have a large body of legacy code that I inherited. It has worked fine until now. Suddenly at a customer trial that I cannot reproduce inhouse, it crashes in malloc. I thin

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 05:43

    Try Asan

    AddressSanitizer (aka ASan) is a memory error detector for C/C++. It finds:

    Use after free (dangling pointer dereference)
    Heap buffer overflow
    Stack buffer overflow
    Global buffer overflow
    Use after return
    Use after scope
    Initialization order bugs
    Memory leaks
    

    Please find the links to know more and how to use it

    https://github.com/google/sanitizers/wiki/AddressSanitizer and https://github.com/google/sanitizers/wiki/AddressSanitizerFlags

提交回复
热议问题