Skip to content

valgrind TThread Init Printf leak definitely lost bytes #8297

@ferdymercury

Description

@ferdymercury

Describe the bug

Running valgrind with a TApplication using TThreads leads to several 'definitely lost' bytes.

72 (16 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 9,521 of 22,023
  in main in /home/user/zdt-daq/gui/main.cxx:26
  1: operator new(unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Init() in /opt/root_src/core/thread/src/TThread.cxx:342
  3: TThread::Initialize() in /opt/root_src/core/thread/src/TThread.cxx:302
  4: ROOT_TThread_Initialize in /opt/root_src/core/thread/src/TThread.cxx:67
  5: ROOT::EnableThreadSafety() in /opt/root_src/core/base/src/TROOT.cxx:498
  6: main in /home/user/zdt-daq/gui/main.cxx:26

2,048 bytes in 1 blocks are definitely lost in loss record 20,895 of 22,023
  in ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:57
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:57
  4: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  5: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  6: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  7: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2,048 bytes in 1 blocks are definitely lost in loss record 20,896 of 22,023
  in ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:193
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:193
  4: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  5: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  6: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  7: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2,048 bytes in 1 blocks are definitely lost in loss record 20,897 of 22,023
  in ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:206
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:206
  4: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  5: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  6: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  7: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2,048 bytes in 1 blocks are definitely lost in loss record 20,898 of 22,023
  in RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:116
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:116
  4: MainWindow::DoStopDAQ() in /home/user/zdt-daq/gui/MainWindow.cpp:1720
  5: MainWindow::SaveAndExit() in /home/user/zdt-daq/gui/MainWindow.cpp:1206
  6: 0x1e5de029
  7: TClingCallFunc::exec(void*, void*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:1843
  8: TClingCallFunc::Exec(void*, TInterpreterValue*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:2102
  9: TCling::CallFunc_Exec(CallFunc_t*, void*) const in /opt/root_src/core/metacling/src/TCling.cxx:7788
  10: TQConnection::SendSignal() in /opt/root_src/core/base/inc/TQConnection.h:76
  11: void TQObject::EmitVA<>(char const*, int) in /home/user/builds/build-root_src-Desktop-Debug/include/TQObject.h:137
  12: void ThSFMC01::EmitVA<>(char const*, int) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  13: ThSFMC01::Emit(char const*) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  14: ThSFMC01::Finished() in /home/user/zdt-daq/gui/ThSFMC01.cpp:47
  15: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:212
  16: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  17: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  18: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  19: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2,048 bytes in 1 blocks are definitely lost in loss record 20,899 of 22,023
  in RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:117
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:117
  4: MainWindow::DoStopDAQ() in /home/user/zdt-daq/gui/MainWindow.cpp:1720
  5: MainWindow::SaveAndExit() in /home/user/zdt-daq/gui/MainWindow.cpp:1206
  6: 0x1e5de029
  7: TClingCallFunc::exec(void*, void*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:1843
  8: TClingCallFunc::Exec(void*, TInterpreterValue*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:2102
  9: TCling::CallFunc_Exec(CallFunc_t*, void*) const in /opt/root_src/core/metacling/src/TCling.cxx:7788
  10: TQConnection::SendSignal() in /opt/root_src/core/base/inc/TQConnection.h:76
  11: void TQObject::EmitVA<>(char const*, int) in /home/user/builds/build-root_src-Desktop-Debug/include/TQObject.h:137
  12: void ThSFMC01::EmitVA<>(char const*, int) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  13: ThSFMC01::Emit(char const*) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  14: ThSFMC01::Finished() in /home/user/zdt-daq/gui/ThSFMC01.cpp:47
  15: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:212
  16: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  17: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  18: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  19: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2,048 bytes in 1 blocks are definitely lost in loss record 20,900 of 22,023
  in RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:118
  1: operator new[](unsigned long) in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so
  2: TThread::Printf(char const*, ...) in /opt/root_src/core/thread/src/TThread.cxx:935
  3: RThread::Stop() in /home/user/zdt-daq/gui/RThread.cpp:118
  4: MainWindow::DoStopDAQ() in /home/user/zdt-daq/gui/MainWindow.cpp:1720
  5: MainWindow::SaveAndExit() in /home/user/zdt-daq/gui/MainWindow.cpp:1206
  6: 0x1e5de029
  7: TClingCallFunc::exec(void*, void*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:1843
  8: TClingCallFunc::Exec(void*, TInterpreterValue*) in /opt/root_src/core/metacling/src/TClingCallFunc.cxx:2102
  9: TCling::CallFunc_Exec(CallFunc_t*, void*) const in /opt/root_src/core/metacling/src/TCling.cxx:7788
  10: TQConnection::SendSignal() in /opt/root_src/core/base/inc/TQConnection.h:76
  11: void TQObject::EmitVA<>(char const*, int) in /home/user/builds/build-root_src-Desktop-Debug/include/TQObject.h:137
  12: void ThSFMC01::EmitVA<>(char const*, int) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  13: ThSFMC01::Emit(char const*) in /home/user/zdt-daq/gui/ThSFMC01.hpp:22
  14: ThSFMC01::Finished() in /home/user/zdt-daq/gui/ThSFMC01.cpp:47
  15: ThSFMC01::ThreadFunction() in /home/user/zdt-daq/gui/ThSFMC01.cpp:212
  16: RThread::ThreadHandle(void*) in /home/user/zdt-daq/gui/RThread.cpp:156
  17: TThread::Function(void*) in /opt/root_src/core/thread/src/TThread.cxx:828
  18: start_thread in /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
  19: clone in /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Expected behavior

The valgrind-ROOT suppression file should prevent these warnings. Or if they are real leaks, they should be fixed.

To Reproduce

Use TThread::Init() and TThread::Printf() together with valgrind --leak-check=full

Setup

  1. ROOT git master
  2. Ubuntu 20
  3. self built

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions