Ariel
Ariel

Reputation: 5830

windbg: how to find size occupied for loaded modules

In windbg, I can list loaded modules with lm.

How can I find the memory footprint of those assemblies?

I'm analyzing a dump of a process suspected of using too much memory, and one thing I'm noticing is the number of assemblies, but not sure what's the size they occupy in memory.

Also, they don't seem to be in contiguous memory positions. Or are they if I sort lm's output some way?

Thanks!

Upvotes: 2

Views: 2210

Answers (2)

Lex Li
Lex Li

Reputation: 63203

You can check each module's size by using lmvm module_name. There is an ImageSize output indicating the hexidecimal size of that module.

Edited: Another way is to first lm to show all modules, and then use !lmi start_address or !lmi module_name to get information about a specific module. !lmi has a Size field that indicates image size.

Note that for .NET 4 native images loaded, you have to use !lmi start_address, as module name resolution fails.

Upvotes: 2

Kjell Gunnar
Kjell Gunnar

Reputation: 3067

The !address -summary gives you a good overview. Check the Image row

0:008> !address -summary

--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free                                    212          b13cb000 (   2.769 Gb)           69.23%
Heap                                    455          25281000 ( 594.504 Mb)  47.18%   14.51%
<unknown>                               861          2168d000 ( 534.551 Mb)  42.42%   13.05%
Image                                   662           4e8e000 (  78.555 Mb)   6.23%    1.92%
Stack                                   156           3400000 (  52.000 Mb)   4.13%    1.27%
Other                                    39             54000 ( 336.000 kb)   0.03%    0.01%
TEB                                      52             34000 ( 208.000 kb)   0.02%    0.00%
PEB                                       1              1000 (   4.000 kb)   0.00%    0.00%

Upvotes: 4

Related Questions