-
Notifications
You must be signed in to change notification settings - Fork 11
Fix a memory leak in LCIO -> EDM4hep conversion #28
Conversation
From what I understand currently, the collections that are converted but never put into the Gaudi TES are leaked. I am not sure there is an easy fix for this, because ownership will probably be a proper mess. The solution here would mean that there are collections that we convert multiple times, because we no longer cache them. However, at the converter level there is no easy way of keeping track of which collections have been added to the TES and which were not, I think. Having said that, we are working on a "standalone" conversion from LCIO to EDM4hep that should hopefully address these concerns, and also have an API that is more similar to the one found in k4EDM4hep2LCIOConv. We should have this ready shortly and are aiming to upstream that to k4EDM4hep2LCIOConv. Could you check if those potential double conversions actually have a measurable impact on the runtime in the end? |
In my original thought, the |
Some comments first to @tmadlener:
While I haven't looked at if this is happening or not I think in most cases this is not happening. What is happening now is that we have a list of collections to go through, get them and register them in k4LCIOReader/k4LCIOReader/src/k4LCIOConverter.cc Lines 206 to 209 in 63e308b
Some timing results, master of
Branch in this PR:
(of course the timing tests are done in the same machine, with the same python script and the same file with 10000 events). Comments for @zoujh: |
Thanks for checking again. I don't see a really easy solution here, unfortunately. The one thing that could be a sort of stop gap to this is to introduce a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As just discussed during the meeting: this is not the ideal solution, but it works for now, and it seems that converting some collections multiple times is an acceptable thing to do performance wise.
Unless @zoujh has any concerns, I think we should merge this to at least fix the memory leak and then see how we handle this in the longer term.
BEGINRELEASENOTES
ENDRELEASENOTES
Fixes key4hep/k4MarlinWrapper#96. The issue is that there are some collections that are created but never deleted so the fix is to make sure to delete them. When running with a file with events with tracks and clusters I don't get any memory leaks with this fix (and I do get them without the fix). To reproduce, build
k4LCIOReader
and then buildk4MarlinWrapper
(needed because the signature of one function changed).Edit: After some discussion in the key4hep call, it has been pointed out that these collections may not be registered correctly