Solving random crashes

前端 未结 17 971
青春惊慌失措
青春惊慌失措 2021-01-31 08:15

I am getting random crashes on my C++ application, it may not crash for a month, and then crash 10 times in a hour, and sometimes it may crash on launch, while sometimes it may

17条回答
  •  无人及你
    2021-01-31 09:12

    Run the application on Linux under valgrind to look for memory errors. Random crashes are usually down to corrupting memory.

    Fix every error you find with valgrind's memcheck tool, and then hopefully the crash will go away.

    If the whole program takes too long to run under valgrind, then split off functionality into unit tests, and run those under valgrind, hopefully you'll find the memory errors that are causing the problems.

    If it doesn't then make sure coredumps are enabled (ulimit -a) and then when it crashes you'll be able to find out where with gdb.

提交回复
热议问题