对于博士发现的此类错误,我能做些什么吗?记忆?
Error #xxx: INVALID HEAP ARGUMENT: allocated with operator new, freed with 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 was 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):
代码看起来像这样(为方便起见添加了行):
string some_function( int i, int j, int k )
{
30: stringstream ss;
(...)
std::string res = ss.str();
(...)
60: return res;
}
编译器是 VisualStudio 2008 sp1,语言原生 c++。当然,在将 .rdbuf()->str() 更改为简单的 .str() 之后 - 没有任何改变,错误仍然存在。