Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-9510 Pythonizations for PyROOT experimental
  3. ROOT-10380

Solve ownership problems for RooArgSet/RooArgList

    XMLWordPrintable

Details

    • Sub-task
    • Status: Open (View Workflow)
    • Medium
    • Resolution: Unresolved
    • 6.18/04
    • None
    • RooFit/RooStats
    • None

    Description

      A typical problem with RooFit used from the Python side is this:

      argList = ROOT.RooArgList()
      argList.add(temporary RooFit object)
      

      On the C++ side, this saves a pointer to the object owned by python. Python will now delete the object, and the C++ side has a dangling pointer.

      One solution is to write a pythonization for RooArgSet's and RooArgList's `add` to hold an extra reference to the python proxy as long as the set/list lives.
      Alternatively, one can use `addOwned` on the C++ side, which should release the ownership of the object on the python side.

      The first solution means that `remove`, `removeAll`, `replace` might need to be touched as well. If that doesn't happen, keeping one object too many around is better than having dangling pointers on the C++ side.

      Attachments

        Issue Links

          Activity

            People

              etejedor Enric Tejedor Saavedra
              shageboe Stephan Hageboeck
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: