title: Tools to analyzing the memory footprint of native DLLs and assemblies loaded in a process?
body: <p>I have a process holding 130MB of memory according to task manager, with only 11MB of live .NET objects according to <a href="http://www.jetbrains.com/profiler/" rel="nofollow noreferrer">dotTrace</a> so I am wondering what's happening with the other 120MB??</p>
  <p>I'd need a tool to list assemblies and native DLLs loaded in a process, gets the size of the images in process, and, for each assembly, measure the memory footprint of the methods JITed.</p>
  <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896656" rel="nofollow noreferrer">ListDlls</a> from SysInternal does partly that job. But it doesn't measure JITed code size and it just provides raw data. Ideally I'd like a UI to analyze and sum-up these data.</p>
  <p>Recently, the Visual Studio team reported having done such analysis with the tool <a href="http://blogs.msdn.com/b/vancem/archive/2011/12/28/publication-of-the-perfview-performance-analysis-tool.aspx" rel="nofollow noreferrer">PerfView</a>. This is stated in the blog post <a href="https://devblogs.microsoft.com/visualstudio/visual-studio-11-beta-performance-part-1/" rel="nofollow noreferrer">Visual Studio 11 Beta Performance Part #1</a>, section: <em>The Biggest VM Consumer - DLLs</em>. Does someone has experience and feedback analyzing native Dlls and assemblies footprint with PerfView?</p>
  <p>Except <em>ListDlls</em> and <em>PerfView</em>, would you recommend any other tool?</p>
  <hr />
  <p>Ok, <a href="http://technet.microsoft.com/en-us/sysinternals/dd535533" rel="nofollow noreferrer">VMMAP</a> advised by <em>Simon Mourier</em> seems to be the more suited tool for this task. <img src="https://i.stack.imgur.com/owpWl.png" alt="enter image description here" /> VMMAP shows that the bulk of working set memory goes into the Managed Stack (113MB in green below), so the problem is more related to .NET objects than unmanaged memory. The green saw tooth curve, is just a timeline of loading/unloading sessions. For some reasons, my first measures were quite wrong:</p>
  <ul>
  <li>dotTrace tells me I have 41MB of .NET objects allocated,</li>
  <li>WMMAP shows a working set of 180MB (task manager shows a similar number)</li>
  <li>WMMAP shows 113MB of managed heap allocated by the GC. 90MB of this managed heap memory is in the working set:</li>
  </ul>
  <p>So my plan is:</p>
  <ol>
  <li>Identify why the GC allocates 113MB of managed heap for 41MB of .NET objects? (are such numbers normal? is it due to high fragmentation?)</li>
  <li>Work on shrinking this 41MB set of .NET objects allocated!</li>
  </ol>