Boost logo

Boost Users :

Subject: Re: [Boost-users] [filesystem] Memory leaks when building with MSVC 2010
From: Will Mason (willchido_at_[hidden])
Date: 2012-05-15 22:00:31


Hello,

On Tue, May 15, 2012 at 8:26 PM, Christian Henning <chhenning_at_[hidden]>wrote:

> Hi there,
>
> I'm stumbling over some memory leaks reported by MSVC when using
> boost::filesystem. Here is simple code sample that can reproduce the
> output below:
>
> #define _CRTDBG_MAP_ALLOC
>
> #include <stdlib.h>
> #include <crtdbg.h>
>
> #define BOOST_FILESYSTEM_VERSION 3
> #include <boost/filesystem/convenience.hpp>
>
> namespace fs = boost::filesystem;
>
> int main(int argc, char* argv[])
> {
> fs::path my_path( "C:\\bla.dat" );
>

This object, my_path, has not yet gone out of scope. Why would you expect
its memory to have been reclaimed in the line that follows?

Cheers,
Will

>
>
> _CrtDumpMemoryLeaks();
>
> return 0;
> }
>
> -- Output:
> 'test.exe': Loaded
> 'C:\gil_contributions\solutions\vc10\test\x64\Debug\test.exe', Symbols
> loaded.
> 'test.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or
> open the PDB file
> 'test.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or
> open the PDB file
> 'test.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find
> or open the PDB file
> 'test.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
> 'test.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
> Detected memory leaks!
> Dumping objects ->
> {268} normal block at 0x0000000000457450, 32 bytes long.
> Data: <C : \ b l a . d > 43 00 3A 00 5C 00 62 00 6C 00 61 00 2E 00 64 00
> {145} normal block at 0x0000000000457F50, 24 bytes long.
> Data: < .? > A8 09 2E 3F 01 00 00 00 01 00 00 00 00 00 00 00
> {143} normal block at 0x0000000000457E50, 16 bytes long.
> Data: <8 > 38 F9 16 00 00 00 00 00 00 00 00 00 00 00 00 00
> {142} normal block at 0x0000000000457DD0, 16 bytes long.
> Data: <@ .? > 40 8B 2E 3F 01 00 00 00 00 00 00 00 00 00 00 00
> {141} normal block at 0x0000000000457D50, 16 bytes long.
> Data: < .? > 10 8B 2E 3F 01 00 00 00 00 00 00 00 00 00 00 00
> Object dump complete.
> The program '[1860] test.exe: Native' has exited with code 0 (0x0).
>
>
> Is this a known issue/nonissue? I have a test suite that uses
> boost::filesystem in numerous areas and the output is somewhat
> disturbing to me.
>
> Regards,
> Christian
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net