Problem calling twice to runmanger

Hi Guys,

I built an application that I build using Boost and call through Python. In the first call, it works fine. In the second call, it crashes when I’m trying to create a run manager. Of course, I delete the run manager at the end of each call, but somehow it still causes an error. I tried to check and run one of the examples twice in a row (i.e. creating a run manger, then deleting it and then creating again) and it also crashed.
Anyone maybe had this issue? Could it be some bug in the deleting process of the run manger?

I created a very simple code that can demonstrate the problem:

int run_main()
{
//
G4RunManager* runManager = new G4RunManager;
delete runManager;
std::cout << “deleted run manager” << std::endl;
return 0;
}

int main(int argc,char** argv)
{
int x = run_main();

int y = run_main();

}

The output of the code is:


Geant4 version Name: geant4-10-05 [MT] (7-December-2018)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


deleted run manager
Segmentation fault (core dumped)

It seems that although the run manager was deleted, there is a problem creating a new run manger.

Geant4 kernel is not designed to be instantiated twice within one execution.

Anyone achieved that ?

We have no plan to make Geant4 kernel re-instantiatable.
Maybe this post is helpful.