|
Boost : |
From: Vernucci, Anthony (vernucci_at_[hidden])
Date: 2005-11-14 13:30:40
I am running a program that links to boost_thread-vc71-mt-gd-1_33.lib.
The following code is the main driver.
#include <test_virtualnetwork.h>
#include <test_stringglobbing.h>
#include <test_internals.h>
#include <test_networking.h>
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
struct leak_reporter {
static leak_reporter instance;
leak_reporter(){
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF |
_CRTDBG_LEAK_CHECK_DF );
}
~leak_reporter(){
_CrtDumpMemoryLeaks(); // replaced by the above
}
};
leak_reporter leak_reporter::instance;
test_suite*
init_unit_test_suite( int, char* [] ) {
test_suite* test= BOOST_TEST_SUITE( "Master Test Suite" );
test->add( new test_virtualnetwork );
test->add( new test_stringglobbing );
test->add( new test_internals );
test->add( new test_networking );
return test;
}
The output is:
Detected memory leaks!
Dumping objects ->
{140} normal block at 0x003657A8, 24 bytes long.
Data: < | > C0 CA 97 7C FF FF FF FF 00 00 00 00 00 00 00 00
{139} normal block at 0x003658F0, 8 bytes long.
Data: < W6 > A8 57 36 00 01 CD CD CD
Object dump complete.
At MSDN I did read that if you #define _CRTDBG_MAP_ALLOC parameter, the
memory leak dump will include the filename and line number info. But I did
not get the file information even though I defined _CRTDBG_MAP_ALLOC.
How do I get the filename and line number to display in the output?
Thanks,
- tony
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk