|
Boost Users : |
Subject: [Boost-users] one memory leak
From: XIN LI (lixinusa2013_at_[hidden])
Date: 2013-12-06 00:48:06
Hi there,
I use boost version 1.49.0. I meet a memory leak for below sentences:
boost::filesystem::path tmp = input.stem();
string strDir = tmp.normalize().string();
Valgrind report memory leak as below:
==18299== 56 bytes in 1 blocks are still reachable in loss record 26 of 61
==18299== at 0x16DF68B8: malloc (vg_replace_malloc.c:270)
==18299== by 0x3F64FEC: operator new(unsigned long) (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x3F5B8F1: stlp_std::priv::__acquire_category(char const*&,
char*, _Locale_name_hint*, char const* (*)(char const*, char*,
_Locale_name_hint*, int*), void* (*)(char const*, _Locale_name_hint*,
int*), char const* (*)(char*),
stlp_std::hash_map<stlp_std::basic_string<char,
stlp_std::char_traits<char>, stlp_std::allocator<char> >,
stlp_std::pair<void*, unsigned long>,
stlp_std::hash<stlp_std::basic_string<char, stlp_std::char_traits<char>,
stlp_std::allocator<char> > >,
stlp_std::equal_to<stlp_std::basic_string<char,
stlp_std::char_traits<char>, stlp_std::allocator<char> > >,
stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,
stlp_std::char_traits<char>, stlp_std::allocator<char> > const,
stlp_std::pair<void*, unsigned long> > > >**, int*) (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x3F5BD04: stlp_std::priv::__acquire_ctype(char const*&,
char*, _Locale_name_hint*, int*) (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x3F3F502: stlp_std::_Locale_impl::insert_ctype_facets(char
const*&, char*, _Locale_name_hint*) (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x3F3DC3C: stlp_std::locale::locale(char const*) (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x458FFFE:
boost::filesystem3::path::wchar_t_codecvt_facet() (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x4591806: boost::filesystem3::path::begin() const (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x4592844: boost::filesystem3::path::m_normalize() (in
/home/lixin/work/prj/hotfix/13q2_ehf1/src/prosim/dist/Debug_64/GNU-Linux-x86/nanospice)
==18299== by 0x21019EB: boost::filesystem3::path::normalize()
(path.hpp:430)
Because my program need run thousands of time and very sensitive for the
memory leak. Could anyone help to suggest one way to avoid such memory leak?
Thanks a lot!
Best wishes,
Andy Li
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