Hello,
I detect some memory leak in my application using valgrind.
The leak happen with PosixThread, after call PosixThread.start() the
reference count of shared_ptr increases by one. When the thread
loses it scope the count reference is with 2. So, there are 2 smart pointers
using the thread. One is mine, and the other?
I found this really strange code in PosixThread.cpp
PosixThread::start()
...
// Create reference
shared_ptr<PthreadThread>* selfRef = new shared_ptr<PthreadThread>();
*selfRef = self_.lock();
...
So, it just creates a local scope smart pointer the let it leak, so, the
reference count will not be decreased letting my thread leaking.
Can some one explain me that?
Sorry by my poor english.
Thanks.
--
Vinicius Tinti -> [email protected], [email protected],
[email protected]
"Here Goes Nothing"
"Beware of bugs in the above code; I have only proved it correct, not tried
it."
"Only those who attempt the absurd can achieve the impossible."
"Never underestimate the power of very stupid people in large groups."
"Simplicity is the ultimate sophistication"
"Beware, I know Ruby-FU"