title: Creating thread that does nothing causing memory leak x64
body: <p>I'm messing around with some threads in preparation for some server work I will do.
  I'm checking for memory leaks with some simple looping code. I noticed that running some code caused a memory leak. The code I assumed was leak proof as it was very simple. So I tried again but this time without any code, just a empty function and I'm still getting the same results.</p>
  
  <pre><code>#include &lt;thread&gt;
  #include &lt;windows.h&gt;
  
  
  void doNothing() {}
  
  int main() {
      for (int i = 0; i &lt; 10000; i++) {
          std::thread thread_obj(doNothing);
          thread_obj.join();
      }
      Sleep(10000000); // &lt;- this sleep here is just so I can monitor the memory in Visual Studio 2019
      return 0;
  }
  
  </code></pre>
  
  <p>Here's the memory usage graph. The point where it flattens out is when it hits the sleep</p>
  
  <p><a href="https://i.stack.imgur.com/3rTC7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3rTC7.png" alt="enter image description here"></a></p>
  
  <p>Heap size after hitting the sleep</p>
  
  <p><a href="https://i.stack.imgur.com/kMDXb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kMDXb.png" alt="enter image description here"></a></p>
  
  <p>And here's the Stack view. Here I'm getting some puzzling results.</p>
  
  <p><a href="https://i.stack.imgur.com/CgJOK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CgJOK.png" alt="enter image description here"></a></p>
  
  <p>Can anyone explain what I'm doing wrong?</p>
  
  <p>I am using x64, Visual Studio 2019 16.5.2</p>
  
  <p>If the answer is obvious, or I'm doing something stupid - I apologise in advance, as this issue seems so fundamental I'm 99% sure I'm doing something wrong.</p>