Opened 8 years ago

Closed 7 years ago

Last modified 3 years ago

#5036 closed Bugs (fixed)

Boost.Test VC memory leak report should direct to stderr

Reported by: anonymous Owned by: Gennadiy Rozental
Milestone: Boost 1.59.0 Component: test
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:


Boost.Test includes a memory leak detection feature (uses the ones MSV provided). Unfortunately it redirects the output to stdout, not conventional stderr.

We are currently creating XML-based test reports. If the memory leak happended, the XML becomes ill-formed. For better interoperability, the debug output should go to stderr.

I traced the place where the called in placed (in boost/test/impl/debug.ipp)

    int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );

    if( !on_off )
        flags &= ~_CRTDBG_LEAK_CHECK_DF;
    else  {
        flags |= _CRTDBG_LEAK_CHECK_DF;
        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);

    _CrtSetDbgFlag ( flags );

The call _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); should be changed to


Change History (2)

comment:1 Changed 7 years ago by Gennadiy Rozental

Resolution: fixed
Status: newclosed

(In [75038]) use stderr as default stream for reporting leak errors (the same as any other reports) Fixes #5036

comment:2 Changed 3 years ago by Raffi Enficiaud

Milestone: To Be DeterminedBoost 1.59.0
Note: See TracTickets for help on using tickets.