|
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.
> http://lists.trolltech.com/qt-interest/2007-08/thread00997-0.html)
>
> 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
{
public:
IgnoreQtStaticData()
{
#if BOOST_MSVC
// Disable all heap debugging, allocate and destroy a QObject,
// then re-enable heap debugging.
int flags = _CrtSetDbgFlag( 0 );
allocate();
_CrtSetDbgFlag( flags );
#endif
}
static void allocate()
{
QObject obj;
};
};
static IgnoreQtStaticData ignoreQtStaticData;
Regards,
-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