Comments (10)
If you run it with:
valgrind --leak-check=full --suppressions=$ROOTSYS/etc/valgrind-root.supp root.exe -l -b -q test.cpp+
you'll get:
==721499== Invalid read of size 4
==721499== at 0x4AF2199: TList::Clear(char const*) (in /opt/root/lib/libCore.so.6.30.04)
==721499== by 0x4AF26D4: TList::~TList() (in /opt/root/lib/libCore.so.6.30.04)
==721499== by 0x4AF287C: TList::~TList() (in /opt/root/lib/libCore.so.6.30.04)
==721499== by 0x2729A8D9: deleteTCollections(TObject*) (in /tmp/tmp/test_cpp.so)
==721499== by 0x2729F039: ???
==721499== by 0x6AA94F7: cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A31E4B: cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A32596: cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A327B7: cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6B09BC6: cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x693813B: HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x694C6E7: TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== Address 0xf0ff6dc is 12 bytes inside a block of size 1,000 free'd
==721499== at 0x484B8AF: operator delete(void*) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==721499== by 0x2729A8D9: deleteTCollections(TObject*) (in /tmp/tmp/test_cpp.so)
==721499== by 0x2729A8D9: deleteTCollections(TObject*) (in /tmp/tmp/test_cpp.so)
==721499== by 0x2729F039: ???
==721499== by 0x6AA94F7: cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A31E4B: cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A32596: cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A327B7: cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6B09BC6: cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x693813B: HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x694C6E7: TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x694CB7A: TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== Block was alloc'd at
==721499== at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==721499== by 0x4A95EDD: TStorage::ObjectAlloc(unsigned long) (in /opt/root/lib/libCore.so.6.30.04)
==721499== by 0x2729AAAE: test() (in /tmp/tmp/test_cpp.so)
==721499== by 0x2729F039: ???
==721499== by 0x6AA94F7: cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A31E4B: cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A32596: cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6A327B7: cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x6B09BC6: cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x693813B: HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x694C6E7: TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (in /opt/root/lib/libCling.so.6.30.04)
==721499== by 0x694CB7A: TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (in /opt/root/lib/libCling.so.6.30.04)
==721499==
Error in <TList::Clear>: A list is accessing an object (0xf0ff6d0) already deleted (list name = TList)
from root.
I conclude that manually deleting the objects is not ok, even if the list is not the owner of the objects.
Am I missing any good practice here?
(edit: I misread the nodelete
flag in the TList::Clear
)
from root.
If you are deleting an object that is contained in a TCollection
, you must remove it from that collection, otherwise the collection has a dangling pointer (that it will use during certain operations, including Clear
but could be any other operation, etc ls()
).
from root.
Maybe setting the content of the dangling TList pointer to NULL just after delete helps ?
from root.
If you are deleting an object that is contained in a
TCollection
, you must remove it from that collection, otherwise the collection has a dangling pointer (that it will use during certain operations, includingClear
but could be any other operation, etcls()
).
Ok, that makes sense, and indeed, it is impossible to do the other way around (i.e. delete obj
before and Remove(obj)
from the list after) as there is no obvious way to know if the object has been deleted. So, there is little you can do from the ROOT side.
Maybe setting the content of the dangling TList pointer to NULL just after delete helps ?
It would break the recursive structure of the deleteTCollections
function, which we'll need to rethink.
Thanks for the clarifications and for your time.
from root.
Hi @mconcas,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely,
🤖
from root.
We are seeing similar issues as a regression when writing ROOT files with 6.30 vs 6.28 (using AIDASoft/podio), and then opening them in older ROOT versions. We're still narrowing this into a reproducer but it seems like something changed in this context to make this issue appear now, with 6.30...
File written by 6.30, read by 6.24
File written by 6.28, read by 6.24
from root.
(I'll file a new issue later today and refer to this one. Consider this a heads-up :-) )
from root.
@wdconinc did you open this issue anywhere? I've also ran what appears to be the same issue.
from root.
No, unfortunately I haven't found the time yet for that one :-) It's been hard to write a reproducer that isn't "take our entire software stack and run a full simulation".
from root.
Related Issues (20)
- Leaking memory though strings in PyROOT HOT 3
- root-framework snap for Ubuntu missing wayland support HOT 11
- Windows CMake project cannot find_library() after integrating with ROOT. HOT 4
- Out-of-bounds vector access in roofit test HOT 3
- [df] ProgressBar reporting on number of files is now broken HOT 5
- Segmentation violation during build on ix86 (32 bit intel) HOT 6
- `THStack` does not automatically shows negative bins HOT 6
- [RF] generate method produces buggy multi-channel dataset
- [RF] Using a conditional RooProdPdf in a multi-channel fit spawns too many integrals with new CPU evaluation backend
- [RF][HS3] Higgs discovery workspaces roundtrip
- [RF][HS3] ATLAS ttbar workspaces roundtrip HOT 3
- [RF] Support for setData method in new EvalBackend classes
- [ci] Add Python version to Windows precomplied release title or filename
- Evaluate using Profile-Guided Optimization (PGO) for optimizing Root's performance HOT 6
- Where can I get arm64 linux binary build? HOT 3
- [ntuple, DAOS] maximum cage size should be part of the anchor
- JS ROOT does not draw tprofile2d correctly with "TEXT" draw option HOT 1
- root_generate_dictionary should check target OUTPUT_NAME
- pyunittests-pyroot-pyz-ttree-setbranchaddress segfaults with Python 3.13 HOT 4
- [("#root:toor, e. g. etc...")]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from root.