Boost logo

Boost Users :

From: Steve M. Robbins (steve_at_[hidden])
Date: 2007-09-04 23:51:41

On Tue, Sep 04, 2007 at 09:02:11AM +0200, Uwe Schuster wrote:

> > My first line of attack is to clean up after Qt somehow.
> > (c.f.
> Hello,
> The hack there doesn't work, because the memory leak detection
> capability is not implemented in Boost.Test itself, it is a feature
> of the MS VC++ Debug runtime libraries (MSVCRxxD.dll), so the leak
> detector starts before that application is running.

Right. I dug a bit further into it and managed to make
the "ignore the first QObject creation" hack work as follows.

// Have Boost.Test ignore the memory leak from Qt static data.
class IgnoreQtStaticData
        // Disable all heap debugging, allocate and destroy a QObject,
        // then re-enable heap debugging.
        int flags = _CrtSetDbgFlag( 0 );
        _CrtSetDbgFlag( flags );

    static void allocate()
        QObject obj;

static IgnoreQtStaticData ignoreQtStaticData;


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at