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-14 09:04:44


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.

I'm still not entirely sure why this bug seemed to be triggered by
linking to the unit test framework library, if anyone has any ideas I'd
be interested to hear them.


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