Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Peter Klotz (peter.klotz_at_[hidden])
Date: 2008-11-22 02:36:22


Gennadiy Rozental wrote:
> Peter Klotz <peter.klotz <at> aon.at> writes:
>
>
>> Here the test_unit pointer is not correct and does not match the one
>> initially registered!
>
> So what? Id match, right? test_unit* is shifted by 4 bytes from test_suite* (it
> does have virtual destructor).
>
> In fact I do not see a reason, why test_suite need virtual destructor. Maybe if
> I remove it, valgrind will be happy? Though I still believe code is valid as is.
>
>> I agree that deregister_test_unit() does not delete the test_suite but
>> the pointers ought to match.
>
> No they should not.
>
>> Maybe you can run my simple test case using valgrind. I used version
>> 3.3.1 under Ubuntu 8.10 i386 (gcc 4.3.2) and Red Hat Enterprise Linux 5
>> x86_64 (gcc 4.1.2).
>
> I do not have valgrind easily accessible at home.

OK, simple solution then.

Why not just adding the virtual destructor to make valgrind happy?

No one will ever report this issue again and our several hundred
internal tests will show no false leaks either.

Regards, Peter.


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