c++ - Error found by Dr.Memory: don't know how to fix it -
is there can such error found dr. memory?
error #xxx: invalid heap argument: allocated operator new, freed free std::_debugheapdelete<std::locale> ??:0 std::ios_base::_ios_base_dtor ??:0 std::ios_base::~ios_base ??:0 std::basic_ios<char,std::char_traits<char> >::~basic_ios<char,std::char_traits<char> > ??:0 std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> >::`vbase destructor' ??:0 some_namespace::some_function() some_source.cpp(60): note: memory allocated here: note: std::ios_base::_init ??:0 note: std::basic_ios<char,std::char_traits<char> >::init ??:0 note: std::basic_istream<char,std::char_traits<char> >::basic_istream<char,std::char_traits<char> > ??:0 note: std::basic_iostream<char,std::char_traits<char> >::basic_iostream<char,std::char_traits<char> > ??:0 note: std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> >::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > ??:0 note: some_namespace::some_function() note: some_source.cpp(30):
where code looks (lines added convenience):
string some_function( int i, int j, int k ) { 30: stringstream ss; (...) std::string res = ss.str(); (...) 60: return res; }
the compiler visualstudio 2008 sp1, language native c++. of course, after changing .rdbuf()->str() .str() - nothing changed, error still exists.
i think bug in dr. memory,
as says "invalid heap argument free 0x0bdd3048" in following code
template<typename chartype> class messagebuilder { (...) { std::basic_ostringstream<chartype> ss; ss << msg; msg_ += ss.str(); --> } };
Comments
Post a Comment