|
Boost Users : |
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-01-16 22:17:29
>
> "Jamie Cook" <jimi.cook_at_[hidden]> wrote in message
> news:d95fba6c0801151506r127233ffj3ca54808e64784fc_at_mail.gmail.com...
> Hi all,
>
> I'm using the boost.test unit tests with memory leak detection turned on
> and I'm slightly puzzled about the format of the output.
> I've been working on getting boost to play nicely with STLport and one of
> the 'problems' I'm having is with memory leaks being
> reported by boost.test which are actually coming from stlport (there is a
> discussion on their FAQ about how these aren't really
> memory leaks at all but that is beside the point). I've managed to get rid
> of most of these leaks but I've still got one hanging around > and I don't
> know where it comes from. My output from my testing looks like this
>
> Embedding manifest...
> Performing Post-Build Event...
> *** No errors detected
> Running 1 test case...
> Detected memory leaks!
> Dumping objects ->
> {171} normal block at 0x00378B88, 1280 bytes long.
> Data: < 7 lationStatis> A8 8D 37 00 6C 61 74 69 6F 6E 53 74 61 74 69 73
> Object dump complete.
>
> My question is this... how can I enable more informative memory leak
> output? In this article () it says that by #define
what article?
> _CRTDBG_MAP_ALLOC, the filename and line number will also be displayed.
> I'm looking into execution_monitor.ipp and I can > see where < crtdbg.h>
> is included but even if I put the #define directly before this include the
> output comes out exactly the same as > above. (and yes I recompiled the
> library)
I has nothing to do with library _CRTDBG_MAP_ALLOC has to be defined ding
test module compilation
> I'm using MSVC8.0, boost 1.34.1 and stlport 5.1.4 and the test library is
> compiled as
> C:\Program Files\boost\boost_1_34_1\libs\test\build>bjam --toolset=msvc
> link=static stdlib=stlport threading=multi
>
> I would really appreciate if anyone could give me some insight on why this
> is being reported in such a way that I can't actually use > it.
I've tried to use it. I added new int; to simple unit test. I can't say
this macro is really usefull. Maybe would you be using malloc instead of new
it produce better report.
Detected memory leaks!
Dumping objects ->
....\microsoft visual studio .net 2003\vc7\include\crtdbg.h(689) : {208}
normal block at 0x003262A8, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.
The better way I found is to use debug version of new instead
#ifdef _DEBUG
#define BOOST_TEST_DEBUG_NEW new( _CLIENT_BLOCK, __FILE__, __LINE__)
#define new BOOST_TEST_DEBUG_NEW
#else
#define BOOST_TEST_DEBUG_NEW
#endif
This one produces following report:
Detected memory leaks!
Dumping objects ->
.....\unit_test_example_01.cpp(33) : {208} client block at 0x003262A0,
subtype 0, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.
Gennadiy
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