Field02 example raising exception

_Geant4 Version: 11.0.0
_Operating System:_Sonoma 14.3
_Compiler/Version: X code 15.3
_CMake Version:_3.29.2

Hi all,

I’m running a modified version of the field02 example but when I do a /run/beamOn 200 it crashes frequently showing an error “libc++abi: terminating due to uncaught exception of type std::bad_alloc: std::bad_alloc”. This seems to occur when the KineE property drops to 134/133 eV. My vis.mac file is unchanged.

Is it possible to change the vis.mac file so it doesn’t tell it to raise an exception?

Apologies for not having a better understanding of the vis.mac file.

Regards

Tim


How and where did you modify the example? Does the stock version run correctly? Have you run your modified code through lldb to trace the source of the exception?

Hi Ben,

The modified example is running heavy ions as opposed to electrons (I changed from gun to GPS) and the path lengths are very much longer than the unmodified example and the modified example seems to be raising an exception due to these much longer path lengths. Indeed, it becomes tricky if I “/run/beamOn 200” and I’m unable to get any decent stats for such a short run and the stock version runs fine.

I’ve not used a debugger on this example (I have some experience with debuggers). I wouldn’t know where to place break or watchpoints.

Regards

Tim

I don’t think you’d need to worry about break/watch points intially - I’d guess you can still get a backtrace after the uncaught exception?

Otherwise, maybe see if you can find a single input event that causes the problem, then up the verbosity of tracking to /tracking/verbose 1 (or 2…) and see that provides any more helpful info.