Opened 10 years ago
Closed 4 years ago
#8007 closed Bugs (worksforme)
Possible memory leak in filesystem::copy()
Reported by: | anonymous | Owned by: | Beman Dawes |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Change History (3)
comment:1 by , 10 years ago
Summary: | Possibly memory leak in filesystem::copy() → Possible memory leak in filesystem::copy() |
---|
comment:2 by , 5 years ago
comment:3 by , 4 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I cannot reproduce the leak with the current develop (effectively, Boost 1.69) and gcc 8.2. Valgrind shows no leaks.
Note:
See TracTickets
for help on using tickets.
Is there any update on this issue? I observe that every time I call filesystem::copy, my app has a jump in memory consumption. Thanks.