Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • athena athena
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Jira
    • Jira
  • Merge requests 194
    • Merge requests 194
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Issue
    • Repository
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • atlas
  • athenaathena
  • Merge requests
  • !39048

Merged
Created Dec 10, 2020 by Scott Snyder@ssnyderDeveloper

TrkDetDescrUtils: Fix memory leaks

  • Overview 3
  • Commits 5
  • Pipelines 1
  • Changes 9

CompactBinnedArray maps bins in some coordinates to a vector of pointers to objects. It does not own this objects.

BinnedMaterial uses CompactBinnedArray, with the object in question being a pair<> object.

When a BinnedMaterial is constructed, it takes a vector of pointers to these pairs. It does not take ownership of this pairs, but just passes them to the CompactBinnedArray.

The callers of BinnedMaterial also do not take ownership of these pairs. So they are presently leaked.

Further, BinnedMaterial can't just delete them, because these pairs get shared between multiple BinnedMaterial instances.

We restructure like this.

BinnnedMaterial now gets a vector of pairs, which it saves as a member. The CompactBinnedArray is then constructed to that it points at the pairs in this vector. BinnedMaterial now effectively owns the pairs. These are now duplicated in each BinnedMaterial, but that should be ok. We also need to extend CompactBinnedArray so that we can give it a new vector of object pointers when it is cloned.

cf ATLASRECTS-5831.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: leak.TrkDetDescrUtils-20201210