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
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
.