Boost logo

Boost Users :

From: Kurt Kohler (kohler_at_[hidden])
Date: 2005-10-05 19:43:16


Your reply actually help me fix the problem! I wasn't aware that the
boost and tr1 versions of shared_ptr are different. When I changed my
code to use the boost version, the problem went away.

I'll have to see if I can figure out where to report the bug.

Thanks!

Peter Dimov wrote:

>Kurt Kohler wrote:
>
>
>>I've run into a strange problem using shared_ptr which I've reduced to
>>the following simple case.
>>
>>#include <tr1/memory>
>>
>>class X
>>{
>>public:
>> typedef std::tr1::shared_ptr<X> Ptr;
>>
>> int x;
>>};
>>
>>int main(int argc, char *argv[])
>>{
>> for (int i = 0; i < 100; i++)
>> {
>> X::Ptr pX(new X);
>> }
>>
>> return EXIT_SUCCESS;
>>}
>>
>>Compiling with g++ 4.0.1 on a Debian system with "-O0 -g -fno-inline
>>-DDEBUG". When this program is run under Valgrind (MemCheck) repeated
>>messages like the following occur.
>>
>>==9950== Conditional jump or move depends on uninitialized value(s)
>>==9950== at 0x1BBB6D9A: pthread_mutex_lock (in
>>/lib/tls/libpthread-2.3.5.so)
>>==9950== by 0x1BB56C75: pthread_mutex_lock (in
>>/lib/tls/libc-2.3.5.so) ==9950== by 0x804BF29:
>>__gthread_mutex_lock(pthread_mutex_t*) (gthr-default.h:510)
>>==9950== by 0x8057ACD: std::tr1::_Sp_counted_base::release()
>>(boost_shared_ptr.h:148)
>>
>>
>
>You seem to be using libstdc++'s implementation of shared_ptr; if the
>problem doesn't occur with boost::shared_ptr, a better place to ask this
>question would be libstdc++'s own mailing list.
>
>_______________________________________________
>Boost-users mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net