#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: |
Description
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)
#ifdef BOOST_MS_CRT_BASED_DEBUG
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 );
#endif // BOOST_MS_CRT_BASED_DEBUG
The call _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); should be changed to
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
Change History (2)
comment:1 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 7 years ago
| Milestone: | To Be Determined → Boost 1.59.0 |
|---|
Note:
See TracTickets
for help on using tickets.

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