Message: Re: Segmentation violation in G4BertiniElectroNuclearBuilder destructor Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Segmentation violation in G4BertiniElectroNuclearBuilder destructor 

Forum: Physics List
Re: None Segmentation violation in G4BertiniElectroNuclearBuilder destructor (Marek Szuba)
Re: Idea Re: Segmentation violation in G4BertiniElectroNuclearBuilder destructor (Vladimir Ivanchenko)
Date: 30 Aug, 2013
From: Marek Szuba <Marek Szuba>

Hello,

Thanks for your suggestions, guys. I think I've figured it out... Sort of figured it out, anyway - while I still do not know why exactly this happened, I now know how to stop it.

The thing is, although the pointer to the physics list was obtained, as shown, from the factory, pointers to OTHER initialisation objects - detector construction and a handful of user actions - were stored in my program as shared_ptrs. It seems that when the function reached its end and variables began to be destroyed due to having gone out of scope, at least some of these objects got removed before the Geant run manager. This resulted, as suggested, in an apparent double-free condition when the G4RunManager destructor began to clean up its dependencies.

Why exactly the segmentation fault appeared in connection to a physics-related object with the physics list NOT assigned to a shared_ptr, I have got no idea. Still, having switched to using ordinary pointers and naked new for detector construction and all user actions made the segfault go away. Hopefully this won't cause any memory leaks.

Cheers,
MS

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Idea: Re: Segmentation violation in G4BertiniElectroNuclearBuilder destructor   (Andrea Dotti - 30 Aug, 2013)
 Add Message Add Message
to: "Re: Segmentation violation in G4BertiniElectroNuclearBuilder destructor"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]