Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][test] Does memory leak detection work in linux?
From: Andrey Torba (andreytorba_at_[hidden])
Date: 2010-03-04 03:07:49


How can i check basic exception safety without detecting memory leaks?
Windows version says that the code below isn't exception safe, but linux
version says nothing.

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/exception_safety.hpp>
#include <boost/test/mock_object.hpp>
using namespace boost::itest;

// Boost
#include <boost/shared_ptr.hpp>

template<class T1, class T2>
void algo(boost::shared_ptr<T1> x,
          boost::shared_ptr<T2> y)
{
}

typedef mock_object<> Mock;
typedef boost::shared_ptr<Mock> SharedMock;

BOOST_TEST_EXCEPTION_SAFETY( TestCase1 )
{
  algo(SharedMock( new Mock() ), // memory leak in case of second Mock
throws exception
       SharedMock( new Mock() ));
}

-- 
Regards, Andrey


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