Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bindings/pyroot/pythonizations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if(roofit)
ROOT/_pythonization/_roofit/_roogenfitstudy.py
ROOT/_pythonization/_roofit/_rooglobalfunc.py
ROOT/_pythonization/_roofit/_roojsonfactorywstool.py
ROOT/_pythonization/_roofit/_roolinkedlist.py
ROOT/_pythonization/_roofit/_roomcstudy.py
ROOT/_pythonization/_roofit/_roomsgservice.py
ROOT/_pythonization/_roofit/_roonllvar.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
MarkerStyle,
)
from ._roojsonfactorywstool import RooJSONFactoryWSTool
from ._roolinkedlist import RooLinkedList
from ._roomcstudy import RooMCStudy
from ._roomsgservice import RooMsgService
from ._roonllvar import RooNLLVar
Expand Down Expand Up @@ -79,6 +80,7 @@
RooDecay,
RooGenFitStudy,
RooJSONFactoryWSTool,
RooLinkedList,
RooMCStudy,
RooMsgService,
RooNLLVar,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Authors:
# * Jonas Rembser 09/2023

################################################################################
# Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. #
# All rights reserved. #
# #
# For the licensing terms see $ROOTSYS/LICENSE. #
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################


class RooLinkedList(object):

def Add(self, arg):
# The Add() method is only changed for the sake of changing the memory
# policy of the cppyy overload. The signature of the original C++
# function is RooLinkedList::Add(RooAbsArg *arg). PyROOT is wrongly
# interpreting this as the RooLinkedList taking ownership of the
# RooAbsArg. This results in a memory leak because nobody feels
# responsible for deleting the arg. This can be fixed by setting the
# memory policy of the method to "strict" and not to "heuristic".
#
# This might become unnecessary in the future if it is decided to set
# the global memory policy to "strict" in _facade.py.

import ROOT

self._Add.__mempolicy__ = ROOT.kMemoryStrict
return self._Add(arg)