[Boost-bugs] [Boost C++ Libraries] #8007: Possibly memory leak in filesystem::copy()

Subject: [Boost-bugs] [Boost C++ Libraries] #8007: Possibly memory leak in filesystem::copy()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-07 11:06:10


#8007: Possibly memory leak in filesystem::copy()
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 I executed my program in valgrind to try to find out some memory leaks and
 I discovered one in boost::filesystem::copy().

 My code is something like this:

 {{{
 namespace fs = boost::filesystem;
 std::string from("file1"), to("file2"); // where from and to are regular
 files
 try {
   fs::copy(from,to); // leak here
 } catch(fs::filesystem_error) {
   // treat exception
 }

 }}}

 The backtrace I could get with valgrind is:

 {{{

 ==4966== 32,768 bytes in 1 blocks are definitely lost in loss record 1,463
 of 1,516
 ==4966== at 0x4C2BBF7: operator new[](unsigned long)
 (vg_replace_malloc.c:363)
 ==4966== by 0x10A09C1:
 boost::filesystem::detail::copy(boost::filesystem::path const&,
 boost::filesystem::path const&, boost::system::error_code*) (in /old
 ==4966== by 0x109A501: boost::filesystem::copy(boost::filesystem::path
 const&, boost::filesystem::path const&) (operations.hpp:367)
 ==4966== by 0x109A26B: System::copyFile(std::string const&, std::string
 const&) (system.cpp:78)

 }}}

 Where System::copyFile(string,string) is a class from my system, which
 basically calls the above code.

 I'm using Ubuntu 12.04 amd64 with boost 1.52 compiled by myself. I'm also
 using jemalloc as memory allocator.

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