WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

[PATCH] fix libstdc++/52604 : __freelist::~__freelist re-initializes _M_thread_freelist

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] fix libstdc++/52604 : __freelist::~__freelist re-initializes _M_thread_freelist

by Laurent Alfonsi :: Rate this Message:

| View Threaded | Show Only this Message

   All,

The attached patch re-initializes _M_thread_freelist in
__freelist::~__freelist just after calling
   ::operator delete(static_cast<void*>(_M_thread_freelist_array));

It avoids valgrind errors in __pool<true>::_M_get_thread_id() later invoked.

Testcases :
   ext/mt_allocator/deallocate_global_thread-1.cc
   ext/mt_allocator/deallocate_global_thread-3.cc

Tested on x86_64-linux (make check, make check-performance).

Laurent

PS : Already approved by Paolo Carlini under the 52604 discussions.

Index: src/c++98/mt_allocator.cc
===================================================================
--- src/c++98/mt_allocator.cc    (revision 186374)
+++ src/c++98/mt_allocator.cc    (working copy)
@@ -48,6 +48,7 @@
     {
       __gthread_key_delete(_M_key);
       ::operator delete(static_cast<void*>(_M_thread_freelist_array));
+      _M_thread_freelist = 0;
     }
     }
   };

Re: [PATCH] fix libstdc++/52604 : __freelist::~__freelist re-initializes _M_thread_freelist

by Laurent Alfonsi :: Rate this Message:

| View Threaded | Show Only this Message

Also, here is the Changelog :

2012-04-13  Laurent Alfonsi <laurent.alfonsi@...>

         PR libstdc++/52604
         * src/mt_allocator.cc: (__freelist::~__freelist): Reset pointer.