You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a class allocates memory in its ctor (and deallocates in dtor). And included in LinkDef.h without + after class name. During I/O, the ctor will be called but not the dtor.
It compiles to gen, read{,_old}. gen produces a .root file containing a tree of user defined class TestData. And readread_old read the tree to do something. read uses RDataFrame language and read_old uses old SetBranchAddress way.
In the constructor of TestData, it will allocate memory for class a_member. And deallocate it in its destructor. Any call to the constructor or destructor of class a_member will be logged.
If #pragma link C++ class TestData;, instead of #pragma link C++ class TestData+; is in the LinkDef.h, the read program will contain multiple call to a_member::a_member but only single or none call to a_member::~a_member, potenially causing memory leak per entry processed.
ROOT version
ROOT v6.32.04
Built for linuxx8664gcc on Aug 21 2024, 00:00:00
From heads/master@tags/v6-32-04
With clang version 18.1.8 (Fedora 18.1.8-3.fc41)
Binary directory: /usr/bin
Installation method
reproducable from self build (from copr), from fedora repo (official version) and ROOT from /cvmfs/sft.cern.ch/lcg/views/LCG_106/x86_64-el9-gcc13-opt/setup.sh
Operating system
Linux Fedora 41 and CentOS9
Additional context
This issue seems to be causing massive memory leak with GENIE. The GENIE related tools manually cleans the resources but it seems I can't do the same with RDataFrame.
The text was updated successfully, but these errors were encountered:
Could you explain why the classes are forced not to be selected without the "+", which brings many benefits, among which performance during the IO procedures?
We are no longer updating the old I/O (the one you get without the +) as its test suite is minimal and we have no idea what users still using are relying on.
However you can straightforwardly migrate to the new I/O and solve the problem for you classes.
After this steps, there is no change in behavior yet.
Go back to the previous code, Generate the dictionary with the '+', this gives the Streamer function that uses the new I/O. Save the code for the next step (Note that the code is entirely boiler plate and with 2 substitutions applies to any class.
Go back to the new code.
Increase the class version number
Replace the write part of the Streamer function with the new I/O version. Merge the read part of the new I/O into to the read part, keeping the old code to only read the data from the old files.
Check duplicate issues.
Description
If a class allocates memory in its ctor (and deallocates in dtor). And included in
LinkDef.h
without+
after class name. During I/O, the ctor will be called but not the dtor.Reproducer
Please refer to this code: https://github.com/karuboniru/root_memory_leak_report
It compiles to
gen
,read{,_old}
.gen
produces a.root
file containing a tree of user defined classTestData
. Andread
read_old
read the tree to do something.read
uses RDataFrame language andread_old
uses oldSetBranchAddress
way.In the constructor of TestData, it will allocate memory for class
a_member
. And deallocate it in its destructor. Any call to the constructor or destructor of classa_member
will be logged.If
#pragma link C++ class TestData;
, instead of#pragma link C++ class TestData+;
is in theLinkDef.h
, the read program will contain multiple call toa_member::a_member
but only single or none call toa_member::~a_member
, potenially causing memory leak per entry processed.ROOT version
Installation method
reproducable from self build (from copr), from fedora repo (official version) and ROOT from
/cvmfs/sft.cern.ch/lcg/views/LCG_106/x86_64-el9-gcc13-opt/setup.sh
Operating system
Linux Fedora 41 and CentOS9
Additional context
This issue seems to be causing massive memory leak with GENIE. The GENIE related tools manually cleans the resources but it seems I can't do the same with RDataFrame.
The text was updated successfully, but these errors were encountered: