   Memory leaks and threads
  I've been working with threads for quite a while now, trying to get the hang of them. I always add the following to a project while programming it://in the main.cpp file#define _CRTDBG_MAP_ALLOC#include &lt;stdlib.h&gt;#include &lt;crtdbg.h&gt;//and this as the first function called_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );I was wondering if this also detects memory leaks that will appear in threads, or do I need to do something more to detect memory leaks in threads?Thanks in advance,Max Henger   
  After trying it:It is enough to call _CrtSetDbgFlag in the main thread.I created my thread with _beginthreadex and allocated a int in it, but never deleted it (i assume this is a memory leak ;) ) and when it was terminated, Visual Studio wrote something like this:Detected memory leaks!Dumping objects ->{338} normal block at 0x00000000003EDC90, 4 bytes long. Data: <    > CD CD CD CD Object dump complete.Hope this helps   ;  how stupid of me! most of the time i create simple tests like these myself. i don't know why i didn't this time. thank you for checking this out for me!