With segmentation faults the only real way to track these done is to build the application in Debug mode and run through a debugger like gdb which will help to locate origin of the problem. There are many threads on the Forum about using gdb so have a search for those, but in short:
-
Configure/build the application in
Debugmode, which can be done with CMake as:$ cmake -DCMAKE_BUILD_TYPE=Debug <otherargs> ... $ make -
Run the application inside
gdb, e.g.$ gdb myapplication ... or if the application takes command line arguments, e.g. a macro ... $ gdb -- myapplication -m macro.macthis should load up the program into
gdband present a command prompt. Simply type> runto run. When the segfault occurs, use the
bt(orbacktrace) command to print a call stack which will show, as the first line or so, the source file and line where the issue occurred.
The above is usually just a first step, but provides the necessary guidance on where to look. As the segfault is occurring after a given number of events, I’d suspect you have a memory leak somewhere.