If we change “Hello, this line is long, LEAK incoming” to be under 32 characters long, then there are no leaks detected.
Command-line test case
$ type main.cpp
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <iostream>
#include <syncstream>
int main() {
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
std::osyncstream bout(std::cout);
bout << "Hello, this line is long, LEAK incoming" << '\n';
bout.emit();
}
$ cl /std:c++20 /permissive- /EHsc /MDd /nologo main.cpp
main.cpp
$ main.exe
Hello, this line is long, LEAK incoming
Detected memory leaks!
Dumping objects ->
{205} normal block at 0x000001B70E3A0360, 32 bytes long.
Data: <Hello, this line> 48 65 6C 6C 6F 2C 20 74 68 69 73 20 6C 69 6E 65
Object dump complete.
Expected behavior
No memory leak.
STL version
Microsoft Visual Studio Community 2022 Preview
Version 17.3.0 Preview 1.1
Additional context
This was originally reported as Devcom-10061535/VSO-1551615/AB#1551615
If we change “Hello, this line is long, LEAK incoming” to be under 32 characters long, then there are no leaks detected.
Command-line test case
Expected behavior
No memory leak.
STL version
Additional context
This was originally reported as Devcom-10061535/VSO-1551615/AB#1551615