Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix memory issue in destruction of StBTofGeometry #355

Merged
merged 1 commit into from
May 20, 2022

Conversation

genevb
Copy link
Contributor

@genevb genevb commented May 20, 2022

@PhilippWeidenkaff reported that MuDst->PicoDst conversion jobs were seg faulting at the end. I investigated in gdb and identified the fault as happening in the destructor of StBTofNode of StBTofGeometry. Looking further with valgrind showed that the issue was that the memory at the location of pView had already been deallocated at the deletion of fView in these two lines:

   delete fView;
   delete pView;

...under the circumstance where these two had been allocated through these lines in StBTofGeometry.cxx:

pView = new TVolumePosition(mTVolume, trans[0], trans[1], trans[2], rotMatrix);
pView->SetMatrixOwner(true);

fView = new TVolumeView( static_cast<TVolume*>(nullptr), pView);

The problem is resolved by not deleting pView if pView points to the same memory as fView->GetPosition(). There may be better ways to do this, but this solution appears to me to be working.

-Gene

@starsdong starsdong merged commit 62374ad into star-bnl:main May 20, 2022
@genevb genevb deleted the StBTofGeometry_MemoryPatch branch September 2, 2022 16:20
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants