
Just curious if anyone else has seen this or anything like it? Platform
is Mac OS X 10.6.1, gcc 4.2.1, boost 1.40.0 installed from MacPorts,
compiling 64-bit (default).
Here's my test code:
#include <sstream>
int main()
{
std::ostringstream str;
str << "Help Me!";
return 0;
}
Here's what I'm doing:
% g++ -o streamtest_bad -ggdb -L/opt/local/lib
-lboost_unit_test_framework-mt-d streamtest.cpp
% ./streamtest_bad
streamtest_bad(63554) malloc: *** error for object 0x7fff7008a500:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
zsh: abort ./streamtest_bad
%
Works fine against other boost libraries, eg system:
% g++ -o streamtest_good -ggdb -L/opt/local/lib -lboost_system-mt-d
streamtest.cpp
% ./streamtest_good
%
Note that this seems to be a separate problem to that reported in
ticket 3432 (https://svn.boost.org/trac/boost/ticket/3432). At least, I
have verified that the framework::clear() function isn't being called
in the above code, which does tend to point the finger at a different
part of the library.
The backtrace is not particularly enlightening, but posted here for the
sake of completeness:
(gdb) bt
#0 0x00007fff87f92ff6 in __kill ()
#1 0x00007fff88034072 in abort ()
#2 0x00007fff87f4b095 in free ()
#3 0x0000000100005533 in __gnu_cxx::new_allocator<char>::deallocate
(this=0x7fff5fbff5df, __p=0x7fff7008a500 "") at new_allocator.h:97
#4 0x0000000100005578 in std::string::_Rep::_M_destroy
(this=0x7fff7008a500, __a=@0x7fff5fbff63f) at basic_string.tcc:431
#5 0x0000000100005939 in std::string::_Rep::_M_dispose
(this=0x7fff7008a500, __a=@0x7fff5fbff63f) at basic_string.h:238
#6 0x000000010000596a in std::basic_string