Terminate by throwing std::bad_alloc when using Geant4 for a large number of events on a cluster

Hello GEANT4 community,

I’m working on a geant4-based code that I’m running on a CentOS rocks-cluster with Geant4-10.07, which is built for multithreading tasks. When I use MPI computation, I switch the run manager to G4RunManager instead of G4MTRunManager and utilize a number of events on each node (1000000 on each node), and it works fine.
But this isn’t always the case; if I change the primary event’s energy to a specific value or use a big number of events (i.e. 5000000 on each node) without exceeding the variable size of G4int type, I get segmentation faults, and it throws this error as in the cases below.

Note that the variables values in the stepping action class, which is invoked at each step, do not consume any additional memory.

Any ideas about the problems and/or the solution?

Thanks for your help.

1 Like

Possibly your hits collection is growing immensely large.