Manages TObject-derived objects created in a PyROOT application.
This class is responsible to keep track of the creation of the objects that need further memory management within ROOT. The ClearProxiedObjects
function is only called at PyROOT shutdown time. The CallCppyyRecursiveRemove
is called as part of the global list of cleanups object destruction.
This class is intentionally not derived from TObject. See the PyROOT::RegulatorCleanup
class for more info.
Definition at line 63 of file TMemoryRegulator.h.
Private Types | |
using | ObjectMap_t = std::unordered_map< Cppyy::TCppObject_t, Cppyy::TCppType_t > |
Private Member Functions | |
TMemoryRegulator () | |
Constructor. | |
void | CallCppyyRecursiveRemove (TObject *object) |
Get the class id of the TObject being deleted and run Cppyy's RecursiveRemove. | |
void | ClearProxiedObjects () |
Clean up all tracked objects. | |
std::pair< bool, bool > | RegisterHook (Cppyy::TCppObject_t, Cppyy::TCppType_t) |
Register a hook that Cppyy runs when constructing an object. | |
std::pair< bool, bool > | UnregisterHook (Cppyy::TCppObject_t, Cppyy::TCppType_t) |
Register a hook that Cppyy runs when deleting an object. | |
Private Attributes | |
ObjectMap_t | fObjectMap {} |
Friends | |
class | RegulatorCleanup |
|
private |
Definition at line 64 of file TMemoryRegulator.h.
|
private |
Constructor.
Registers the hooks to run on Cppyy's object construction and destruction
Definition at line 21 of file TMemoryRegulator.cxx.
|
private |
Get the class id of the TObject being deleted and run Cppyy's RecursiveRemove.
[in] | object | Object being destructed. |
Definition at line 69 of file TMemoryRegulator.cxx.
|
private |
Clean up all tracked objects.
Definition at line 81 of file TMemoryRegulator.cxx.
|
private |
Register a hook that Cppyy runs when constructing an object.
[in] | cppobj | Address of the object. |
[in] | klass | Class id of the object. |
Definition at line 35 of file TMemoryRegulator.cxx.
|
private |
Register a hook that Cppyy runs when deleting an object.
[in] | cppobj | Address of the object. |
[in] | klass | Class id of the object. |
Definition at line 52 of file TMemoryRegulator.cxx.
|
friend |
Definition at line 78 of file TMemoryRegulator.h.
|
private |
Definition at line 66 of file TMemoryRegulator.h.