Boost logo

Boost Users :

From: Steve M. Robbins (steve_at_[hidden])
Date: 2007-08-31 13:38:13


Hi,

I'd appreciate some advice using the Boost unit testing library with
Qt classes.

I'm using MSVC 8.0 on windows XP.

It appears that simply creating and destroying a QObject allocates some
static datastructures which are reported as a memory leak by Boost.Test.
I'd like to somehow suppress this "static leak" so that Boost.Test may
find real leaks in my code. Consider the following test program

  #define BOOST_AUTO_TEST_MAIN
  #include <boost/test/auto_unit_test.hpp>
  #include <Qt/qobject.h>

  BOOST_AUTO_TEST_CASE( example )
  {
      BOOST_CHECK_EQUAL( 1, 1 );
      QObject obj;
  }

It builds and runs fine, except that memory leaks are detected.

My first line of attack is to clean up after Qt somehow.
(c.f. http://lists.trolltech.com/qt-interest/2007-08/thread00997-0.html)
But failing that, is there some way to have Boost.Test ignore these
static allocations?

I tried turning off leak detection, allocating and deleting a QObject,
then turning leak detection back on. But the leaks are still reported.

Any ideas?

Thanks,
-Steve


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