[Boost-bugs] [Boost C++ Libraries] #4031: vectorstream causes a memory leak at construction

Subject: [Boost-bugs] [Boost C++ Libraries] #4031: vectorstream causes a memory leak at construction
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-22 15:04:07


#4031: vectorstream causes a memory leak at construction
------------------------------------------------------------+---------------
 Reporter: Mark Domschot <mark.domschot@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: interprocess
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: vectorstream, memory leak, init |
------------------------------------------------------------+---------------
 Hi,

 This happens with Visual Studio 2008 (msvcp90.dll).

 When a vectorstream is constructed, it specifically calls
 'basic_ios_t::init()' on 'm_buf' after 'm_buf' was already initialized in
 its constructor.

 The leak occurs in 'std::ios_base::_Init()', which has a pointer to a 4
 byte locale.

 It is worth noting that the memory leak detector that visual studio
 provides you will not report this leak. That tool does not report any
 memory with the block type of _CRT_BLOCK (Apparently no one at MS must
 make mistakes ;) ). If you want to see it with that tool, you can step
 into the allocation and manually change the block variable from 2 to 1.

 Test program (its so short, the isn't a need to attach it):
 #include <boost\interprocess\streams\vectorstream.hpp>
 #include <boost\interprocess\containers\string.hpp>

 namespace ip = boost::interprocess;

 int main(int argc, char* argv[])
 {
     ip::basic_vectorstream<ip::string> stream1;
 }

 - Mark

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4031>
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:02 UTC