Simplify memory regulation logic#16837
Conversation
adf6a99 to
b8589d7
Compare
Test Results 19 files 19 suites 4d 9h 35m 18s ⏱️ Results for commit 4baf51d. ♻️ This comment has been updated with latest results. |
7edc459 to
3f53362
Compare
guitargeek
left a comment
There was a problem hiding this comment.
This is really great, and the CI also starts to be green! The failures are unrelated and caused by #16697. FYI, @ferdymercury.
Yep, it's because the sibling roottest PR was overlooked. (Should have been merged simultaneously) |
* Remove usage of lambda with capture of class data member, move to free functions with singleton. * Remove TMemoryRegulator class and only keep the needed functionality in RegulatorCleanup * Remove extra call to `ClearProxiedObjects`, as those objects are automatically deregistered by the Python GC through cppyy's memory regulator. The only remaining feature for the PyROOT atexit cleanup logic is the `CallCppyyRecursiveRemove` function that is still required for TObject-derived instances. Unfortunately, it is still somewhat fragile. With the changes in this commit, which bring back our full suite of CI platforms to green, the interplay between `CPyCppyy::MemoryRegulator::RecursiveRemove` and our own map of tracked objects is subtle. At the moment it looks like the call to `RecursiveRemove` may invalidate the memory pointed to by the map bucket, so we erase that first.
This avoids potential double-delete situations that might arise during the atexit cleanup logic of PyROOT.
3f53362 to
4baf51d
Compare
|
I have added more comments to the commit descriptions. Once the CI confirms these changes indeed work I will merge. Also, we can merge the CI for ubuntu24.10 directly with this PR. |
|
Nice! And cool to see that it also works on Fedora 41 with Python 3.13 |
With all these changes, I do not see anymore failures in a local run with the ubuntu 24.10 CI image. let's see if the rest of the CI agrees. Note that one of the changes is equivalent to #16671