Memory leak issue in reset() function from boost::thread_specific_ptr
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
Start with the minimal program in the issue and run the supplied Valgrind command to reproduce the report. Trace boost::thread_specific_ptr::reset() through the thread-specific storage functions named in the leak stack. Done means the reported allocation is no longer leaked while the reset() example continues to behave correctly.
Written by the indexing model from the issue text.
Description
Following memory leak issue is observed with reset() method from boost::thread_specific_ptr by using valgrind tool in Boost 1.75.
### Leak description:
==27891== 24 bytes in 1 blocks are still reachable in loss record 1 of 2
==27891== at 0x4835DEF: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==27891== by 0x113064: boost::detail::make_external_thread_data() (in /home/{user}/boost_1_75_0/a.out)
==27891== by 0x114084: boost::detail::add_new_tss_node(void const*, void (*)(void (*)(void*), void*), void (*)(void*), void*) (in /home/{user}/boost_1_75_0/a.out)
==27891== by 0x1102F5: boost::thread_specific_ptr<int>::reset(int*) (in /home/{user}/boost_1_75_0/a.out)
==27891== by 0x10DC07: main (in /home/{user}/boost_1_75_0/a.out)
Code Snippet:
#include <boost/thread.hpp>
#include <iostream>
int main()
{
boost::thread_specific_ptr<int> conv_thread_ptr;
if(!conv_thread_ptr.get())
{
conv_thread_ptr.reset(new int);
}
return 0;
}
Command used for compilation:
g++ main.cpp -I./boost_1_75_0_install/include ./boost_1_75_0_install/lib/libboost_thread.a -lpthread
Command used for memory leak checking with valgrind:
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./a.out
@vaishnavkatiyar
- Dominant language
- C++
- Stars
- 213
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/thread
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·