Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] Malloc exceptions when using test framework on 64bit OS X 10.6.1
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-09-29 04:56:02


Peter Klotz <peter.klotz <at> aon.at> writes:

> 1) Why are you insisting on casting tu.second to test_case*?
>
> Actually you want your derived class destroyed but tu.second is a base
> class pointer of type test_unit*. You can simply call "delete tu.second"
> if the test_unit destructor is virtual. The whole casting thing is in my
> opinion just a workaround for not making the destructor virtual.

I disagree. The whole idea is that I do NOT use these pointers polymorphically.
And never intended to. This is just a storage for proper memory management,
where I've decided to use one array instead of two and thus keep them as
test_unit*, knowing that I have correct type at runtime anyway.

Making the destructor virtual is only make sense if there are other virtual
function (and even in this case there is exception). test_unit has none. Also
don't forget that making needlessly class destructor virtual you immediately
increase instance size by 4 or 8

> 2) I am seeing the problem on 32Bit Intel Linux as well, so it is not
> restricted to 64Bit.

This makes more sense.

Gennadiy


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