c++ - 这是微软实现 std::thread 的一个大错误吗?

标签 c++ visual-c++ memory-leaks c++11 stdthread

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <thread>

using namespace std;

void Hello()
{}

int main()
{
    {
        std::thread(Hello).join();
    }    

    _CrtDumpMemoryLeaks();
}

输出窗口显示:(VC++ 编译器版本:2012 年 11 月 CTP)

The thread 0x5ab8 has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{261} normal block at 0x002A2E00, 44 bytes long.
 Data: <                > 01 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 
Object dump complete.
The thread 0x5abc has exited with code 0 (0x0).
The thread 0x5ab4 has exited with code 0 (0x0).
The program '[0x5A94] C++11.exe' has exited with code 0 (0x0).

最佳答案

关于c++ - 这是微软实现 std::thread 的一个大错误吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14238670/

相关文章:

c++ - OpenCV findFundamentalMat 是否在计算前应用归一化

c++ - 非类型模板参数中的占位符类型是否可以涉及作为模板参数传递的函数的重载解析?

c++ - 删除前向声明的指针时没有警告 (Visual Studio)

java - Xpath内存泄漏?

c++ - Valgrind 在定义 char* 数组时报告内存泄漏

c++ - 避免公共(public)类中重复代码

c++ - 指针变量在数组内使用float计算平均值C++

c++11 - 为什么在编译时不评估 constexpr (MSVC 2015)?

c++ - 通过值传递参数时的奇怪行为

c++ - 循环中的预递增/递减与使用 gcc 和 Visual C 的递增/递减