vs2017 C++ 电脑安装了boost 1.73.0
#include <iostream>
#include <thread>
#include <Windows.h>
using namespace std;
void thread01()
{
for (int i = 0; i < 5; i++)
{
//cout << "Thread 01 is working !" << endl;
Sleep(1000);
}
}
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
thread task01(thread01);
task01.detach();
return 0;
}
运行后内存泄漏
Detected memory leaks!
Dumping objects ->
{153} normal block at 0x00AC5AF0, 4 bytes long.
Data: < > 9D 13 C6 00
Object dump complete.