Re: [Boost-bugs] [Boost C++ Libraries] #8395: Valgrind error in lockfree::queue

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8395: Valgrind error in lockfree::queue
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-05 13:57:37


#8395: Valgrind error in lockfree::queue
-------------------------------+--------------------------------------------
  Reporter: adam@… | Owner: timblechmann
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: lockfree
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------

Comment (by adam@…):

 Having delved a little further I concur, the patch was more of a
 confirmation for me of where the warning was coming from.

 On further analysis:

 The warning does not occur if the container is not given a size at
 construction:
 {{{
 boost::lockfree::queue<int*> q;
 }}}
 and appears to be caused by the allocation, but not construction, of all
 the nodes in the freelist class.

 If I understand correctly, it doesn't matter that the next tag is
 uninitialised, the only important thing is that the new tag is different
 to the old tag for tags that reside at the same address - so in that
 sense, this is a false positive (and the patch is bad!).

 One option would be to add a constructor or policy to the freelist class
 that caused it to zero initialise memory on allocation, or to use a custom
 allocator with the same behaviour, which I think would suppress the
 warning. I don't think this would cause any issues because the freelist
 doesn't do any "real" deallocation until destruction.

 I've attached another patch (attachment:lockfree2.patch) that implements
 the custom allocator strategy. Again, this appears to successfully
 suppress the valgrind warning, I can't say whether or not there are other
 unintended side effects though.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8395#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC