Error segmentation fault (core dump)

Hi Dear Geant4 !
I’m trying to run my code but face to some issue (error segmentation fault (core dump)).
When the event is less than 8000, the code execute well. Increasing the number of event more than this value I have the core dump issue.
can someone help me to understand what can be the cause and how do I fix it ?


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:

  1. Configure/build the application in Debug mode, which can be done with CMake as:

    $ cmake -DCMAKE_BUILD_TYPE=Debug <otherargs>
    $ make
  2. 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.mac

    this should load up the program into gdb and present a command prompt. Simply type

    > run

    to run. When the segfault occurs, use the bt (or backtrace) 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.

@bmorgan, Thank for see reply.
I’ll try to see