title: Get number of blocks allocated on the heap to detect memory leaks
body: <p>Is there a function available that can get the number of blocks of memory that are currently allocated on the heap? It can be Windows/Visual Studio specific.</p>
  
  <p>I'd like to use that to check if a function leaks memory, without using a dedicated profiler. I'm thinking about something like this:</p>
  
  <pre><code>int before = AllocatedBlocksCount();
  foo();
  if (AllocatedBlocksCount() &gt; before)
      printf("Memory leak!!!");
  </code></pre>