Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] Linking against boost_unit_test_framework causes double-deletion in std::ostringstream
From: Alastair Rankine (arsptr_at_[hidden])
Date: 2009-11-16 07:57:48


On 2009-11-15 01:04:44 +1100, Alastair Rankine <arsptr_at_[hidden]> said:

> On 2009-11-10 21:50:20 +1100, Alastair Rankine <arsptr_at_[hidden]> said:
>
>> 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).
>>
>> % 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
>> %
>
>
> OK here's the fix for whoever is interested. Basically it seems to be
> an instance of this problem:
> http://www.newartisans.com/2009/10/a-c-gotcha-on-snow-leopard.html (and
> it's not a double-deletion, it's trying to delete an object on the
> stack).
>
> The root cause seems to be system headers not matching the libraries,
> and the fix is to rebuild with -D_GLIBCXX_FULLY_DYNAMIC_STRING.

Not quite.

It's actually the debug variant of boost in MacPorts.

This silently enables _GLIBCXX_DEBUG for the build, but which is also
required in your own applications.

More info in the ticket here: http://trac.macports.org/ticket/22112#comment:2


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