-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ROOTFrameData leaks collection buffers that are not requested by the Frame #500
Comments
I am not sure if this was introduced with the
are leaked. This should be fairly straight forward to fix by simply cleaning them up in the podio/python/templates/CollectionData.cc.jinja2 Lines 31 to 46 in 4d6c0b7
However, this will only fix half of the problem as there might be collection (buffers) that are read but from which no collection is every constructed (simply by the way the whole Frame concept works) and the fact that we will always read the complete event (until #499 is fixed). CollectionBuffers that are read, but from which no collection is constructed will leak (pretty much) all their data. |
The slightly counterintuitive workaround until this is properly fixed is to read all collections from the event, i.e. in python: from podio import root_io
reader = root_io.Reader("example_frame.root")
for event in reader.get("events"):
# read all collections to work around AIDASoft/podio#500
for c in event.collections:
event.get(c)
# continue with actual event loop or in c++: #include "podio/Frame.h"
#include "podio/ROOTFrameReader.h"
void demo() {
auto reader = podio::ROOTFrameReader();
reader.openFile("example_frame.root");
for (int i = 0; i < reader.getEntries("events"); ++i) {
auto event = podio::Frame(reader.readNextEntry("events"));
// read all collections to work around AIDASoft/podio#500
for (const auto& name : event.getAvailableCollections()) {
event.get(name);
}
// Continue with the actual event loop
}
} |
Reading only part of the collections stored in a frame should not lead to leaked memory (see e.g. AIDASoft#500). The tests that are added in this commit are targetting that, specifically by running them with sanitizers enabled.
Reading only part of the collections stored in a frame should not lead to leaked memory (see e.g. AIDASoft#500). The tests that are added in this commit are targetting that, specifically by running them with sanitizers enabled.
When reading files via the
ROOTFrameReader
memory increases steadily.(This most likely also applies to other readers). The minimal reproducer looks something like thisA quick run to valgrind seems to indicate that some of the data that is allocated in
createBuffers
becomes unreachable somewhere in the chain from creating it to constructingCollectionData
from the buffers. Currently trying to figure out where things go wrong and whether this is a ROOT exclusive problem or whether this is a general podio issue (which I assume currently).The text was updated successfully, but these errors were encountered: