Problem 2567

Summary: reinitializeGeometry causes memory leak?
Product: Geant4 Reporter: Alvaro Tolosa Delgado <alvaro.tolosa.delgado>
Component: runAssignee: Makoto Asai <asai>
Status: NEW ---    
Severity: minor CC: alvaro.tolosa.delgado
Priority: P4    
Version: 11.1   
Hardware: All   
OS: All   

Description Alvaro Tolosa Delgado 2023-10-20 11:23:01 CEST
/run/reinitializeGeometry increase memory usage after every call, I am not sure if that behavior is expected.

The effect can be tested in any example. To reproduce the issue, the /run/reinitializeGeometry command can be placed in a dedicated macro file:

######
# reinit.mac
/run/reinitializeGeometry
######

And then inside the interactive session of any example (B1, B4x), called in a loop:
/control/loop reinit.mac i 0 1000000

And then watch how the memory keeps increasing.

I am not sure if the effect is more critical for more complex geometries than the ones in the examples.
Comment 1 Gabriele Cosmo 2023-10-20 11:37:11 CEST
Have you tried with "/run/reinitializeGeometry true", i.e. instruct to destroy first the old setup?
Comment 2 Alvaro Tolosa Delgado 2023-10-20 11:45:38 CEST
The default value of the parameter is true. I tried "/run/reinitializeGeometry true" but memory kept growing as happened without specifying the parameter.