title: How to research what resources are leaked by which application (not a full ATOM table issue)
body: <p>Some application on my system is leaking resources. But I don't know what it is leaking and which application.</p>
  
  <p>The leak causes other applications to fail with error messages like this:</p>
  
  <blockquote>
    <p>System Error. Code: 8. Not enough storage is available to process this command.</p>
  </blockquote>
  
  <p>What tools and/or steps can I use to find out which application is leaking and what it is leaking?</p>
  
  <p>note: I have</p>
  
  <ul>
  <li>40% of memory free (of a total of 8 gigabytes)</li>
  <li>15 gigabytes space free on the boot/system SSD drive</li>
  <li>all the rights I need (can be Admin when needed)</li>
  <li>a Windows 7 development workstation (with things like Visual Studio 2013, Delphi 2007, PL/SQL Developer 9, Office 2013, McAfee 8, IE 11, Chrome 44, Cisco Jabber)</li>
  <li>some developed applications and services running (but not many)</li>
  <li>Our Delphi services and applications run with FastMM in full debug mode and don't show memory leaks.</li>
  <li><strike>about 200 string ATOMS in use (see dump at <a href="https://gist.github.com/anonymous/a4954baa256ddacbe1a8" rel="nofollow noreferrer">https://gist.github.com/anonymous/a4954baa256ddacbe1a8</a>) so it's not a full ATOM table issue.</strike> It <em>was</em> ATOMS, but while refactoring the code by <a href="https://stackoverflow.com/users/1108091/jordi-corbilla">https://stackoverflow.com/users/1108091/jordi-corbilla</a> and <a href="https://stackoverflow.com/users/112670/christian-b-almeida">https://stackoverflow.com/users/112670/christian-b-almeida</a> I accidentally killed very odd atoms in <a href="https://gist.github.com/anonymous/1deb17123d57f160c4b2" rel="nofollow noreferrer">https://gist.github.com/anonymous/1deb17123d57f160c4b2</a> which I will answer below.</li>
  <li>standard Windows 7 heaps with a large Desktop heap: <code>SharedSection=1024,20480,768</code> </li>
  <li>it is not the RegisterWindowsMessages either: about 1000 of them in total: <a href="https://gist.github.com/anonymous/027b26809d66970b25b8" rel="nofollow noreferrer">https://gist.github.com/anonymous/027b26809d66970b25b8</a></li>
  <li>it isn't a window handle count either, as <code>Testlimit -u</code> can happily allocate 10k USER handles: <a href="https://gist.github.com/anonymous/7296453116c5826d632d" rel="nofollow noreferrer">https://gist.github.com/anonymous/7296453116c5826d632d</a></li>
  </ul>
  
  <p>Since it could just as well be one of our own developed applications, I ask it here instead of superuser/serverfault. We don't get this on our servers though.</p>
  
  <hr>
  
  <p>Since I can't answer, here is the elaboration:</p>
  
  <p>The tooling in the "non-duplicate" answer can't pinpoint the source for various reasons:</p>
  
  <ul>
  <li>they call Windows API functions with wrong data</li>
  <li>they presume Thread IDs are the same as Process IDs</li>
  <li>they contain very limited source code (the most interesting UI application is lacking)</li>
  <li>the binaries of the incomplete source code don't function well using truckloads of CPU and not responding to the UI after initial clicks</li>
  <li>the source does not explain what they do and why they do it</li>
  </ul>
  
  <p>I'm in the midst of combining those pieces of code and refactoring it to a useful console application that:</p>
  
  <ul>
  <li>shows Atoms and Registered Windows messages</li>
  <li>indicates by which Application </li>
  <li>shows percentage used</li>
  <li>can better estimate what ATOMS to free</li>
  </ul>
  
  <p>That way, dumping the output over time and correlating the diffs it might be possible to zoom in to the offending problem.</p>
  
  <p>The offending ATOM leaks look like this:</p>
  
  <pre><code>Atom 0xD8F8 with name "-%D4#!`````(W!```````@W#````````"
  Atom 0xD8F9 with name "-%D4#!`````HT!```````@W#````````"
  Atom 0xD8FA with name "-%D4#!`````+R!```````@W#````````"
  Atom 0xD8FB with name "-%D4#!`````3P!```````@W#````````"
  Atom 0xD8FC with name "-%D4#!`````*S!```````@W#````````"
  Atom 0xD8FD with name "-%D4#!`````KO!```````@W#````````"
  Atom 0xD8FE with name "-%D4#!`````,T!```````@W#````````"
  </code></pre>
  
  <p>Statistics look like this:</p>
  
  <pre><code>Total Global Atoms: 6405
  Total is 39 percent of maximum 16384 Global Atoms.
  Total Registered WindowsMessages: 1940
  Total is 11 percent of maximum 16384 Registered WindowsMessages.
  </code></pre>