title: WinDbg find all C++ objects of type X on heap that do not use inheritance (no vftable)
body: <p>I have a C++ application with debug symbols, and created a dump file of such application with all relevant gflags enabled:</p>
  <pre><code>gflags /i xxx.exe +hpa
  gflags /i xxx.exe +ust
  </code></pre>
  <p>Now, I have found from other questions <a href="https://stackoverflow.com/questions/3123703/find-all-c-objects-of-type-x-on-heap-using-windbg">(see here)</a>, that by first looking for a type's vftable address:</p>
  <pre><code>x module!SomeClass*table*
  </code></pre>
  <p>And then searching the heap for that address:</p>
  <pre><code>!heap -srch 'address_of_vtable'
  </code></pre>
  <p>I can find all instances of that type. That is true, <strong>if the vftable exists for such type</strong>.</p>
  <p>From what I have read, the vftable is only created for types that use inheritance, but if a type does not  use inhertance at all, then it does not get created.</p>
  <p>If the vftable is not created then the approach above does not seem to work. I can find an address for the type using (no vftable):</p>
  <pre><code> x module!SomeClass::SomeClass
  </code></pre>
  <p>But if I search the heap for the returned address, there are no matches, eventhough I know I have several instances of such type.</p>
  <p>What other people have done is <a href="https://stackoverflow.com/questions/54481737/enforcing-a-vftable-entry-in-windbg-x-2-results-what-to-consider">to force the creation of the vftable</a>, but modifying the code base in such a way for the sake of debugging does not seem like a good or practical approach for existing large code bases.</p>
  <p>Is there a way, combination of windbg commands, to look for instances of a (non-inheritance) type in a dump file without having to modify the source code?</p>
  <p>NOTE : I know there are other tools for heap analysis, like umdh and heap snapshots with WPR, but I assume I only have a regular, full, good old-fashined dump. All the heap information is in that dump, have the symbols and sources, so there must be a way, right?</p>