I have a memory leak with this simple code using std :: thread in Visual Studio Pro 2012:
#include <thread> void f(){} int main(){ std::thread t(f); t.join(); _CrtDumpMemoryLeaks(); return 0;}
Win32 output:
Detected memory leaks! Dumping objects -> {293} normal block at 0x00A89520, 44 bytes long. Data: < > 01 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 Object dump complete.
x64 Output:
Detected memory leaks! Dumping objects -> {293} normal block at 0x00000000003FCB00, 72 bytes long. Data: < > 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Object dump complete.
If I comment on the first two lines of the main method, I have no memory leaks.
Where is he from?
EDIT: The leak is still here with this code:
#include <thread> void f(){} int main(){ { std::thread t(f); t.join(); } _CrtDumpMemoryLeaks(); return 0;}
source share