分析进程中加载​​的本机DLL和程序集的内存占用的工具? [英] Tools to analyzing the memory footprint of native DLLs and assemblies loaded in a process?

查看:202
本文介绍了分析进程中加载​​的本机DLL和程序集的内存占用的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据任务管理器,我有一个持有130MB内存的进程,根据只有11MB的活.NET对象dotTrace ,所以我想知道其他120MB的发生了什么?

I have a process holding 130MB of memory according to task manager, with only 11MB of live .NET objects according to dotTrace so I am wondering what's happening with the other 120MB??

我需要一个工具来列出在进程中加载​​的程序集和本机DLL,获取正在处理的图像的大小以及每个程序集测量JITed方法的内存占用。

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.

ListDlls 部分是这个工作。但是它不测量JITed代码大小,它只提供原始数据。理想情况下,我想要一个UI来分析和总结这些数据。

ListDlls 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.

最近,Visual Studio团队报告了使用工具 PerfView 。这在博客文章 Visual Studio 11 Beta Performance Part#1 ,部分:最大的虚拟机消费者 - DLLs 。有人有使用PerfView分析本机Dll和程序集的体验和反馈?

Recently, the Visual Studio team reported having done such analysis with the tool PerfView. This is stated in the blog post Visual Studio 11 Beta Performance Part #1, section: The Biggest VM Consumer - DLLs. Does someone has experience and feedback analyzing native Dlls and assemblies footprint with PerfView?

除了 ListDlls PerfView 你推荐任何其他工具?

Except ListDlls and PerfView, would you recommend any other tool?

好的, VMMAP 由Simon Mourier通知似乎是更适合此任务的工具。 img src =https://i.stack.imgur.com/owpWl.pngalt =在此输入图像描述> VMMAP显示,大部分工作集内存进入托管堆栈(113MB,绿色以下) ,所以与非托管内存相比,该问题与.NET对象更相关。绿色锯齿曲线,只是加载/卸载会议的时间表。由于某些原因,我的第一个措施是错误的:

Ok, VMMAP advised by Simon Mourier seems to be the more suited tool for this task. 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:


  • dotTrace告诉我,我已经分配了41MB的.NET对象,

  • WMMAP显示一个180MB的工作集(任务管理器显示类似的数字)

  • WMMAP显示了由GC分配的113MB的托管堆。这个管理堆内存中有90MB在工作集中:

所以我的计划是:


  1. 确定为什么GC为41MB的.NET对象分配113MB的托管堆? (这样的数字是正常的吗?是因为高分段?)

  2. 正在缩小这个41MB的.NET对象分配!


推荐答案

由于你提到了sysinternals的ListDlls,还有一个名为 Process Explorer ,它具有大量的信息,比ListDlls好得多(你想确保你有最新的版本,也有很多的.NET信息,支持64位和32位进程等)。

Since you mention sysinternals' ListDlls, there is another tool called Process Explorer that has tons of information, and is much much better than ListDlls (you want to make sure you have the latest versions that also has a lot of .NET information, supports 64-bit and 32-bit processes, etc.).

对于每个进程,您可以同时查看非托管内存(专用字节等)和管理的内存(GC集合,大型对象堆等)显示在列或每个进程。

For each process, you can have a simultaneous views of unmanaged memory (private bytes et al.) and managed memory (GC collections, large object heap, etc.) displayed in columns or per process.

来自sysinternals的另一个很酷的工具是 VMMAP 。它是一个进程内存分析实用程序,并显示不同类型的虚拟和物理内存类型的细目。

Another cool tool from sysinternals is VMMAP. It's a process memory analysis utility and shows a breakdown of different types of virtual and physical memory types.

至于你120Mb的问题,你真的想检查所有非托管DLL被注入到您的进程中,并不属于标准Windows安装或标准DLL进程集的一部分。对于这样大的大小分配,我将首先跟踪图形组件,因为它们特别为分配大块内存而着名(特别是如果您谈论的是一个诸如NDepend的工具,这个工具就是图形)。 Process Explorer还可以跟踪GDI和USER对象的数量。

As for you 120Mb question, you really want to check all unmanaged DLLs that are injected in your process and are not part of standard Windows installation or standard DLL set of processes. For such big size allocations, I would first track graphical components of course as they are notably known for allocation big chunks of memory (especially if you speak about a tool such as NDepend which is graphical). Process Explorer can also tracks the number of GDI and USER objects.

在GDI主题上,有一个免费的工具,名为 GDIView ,这里提供了每个进程分配的GDI对象的详细信息。

On the GDI topic, there is a free tool named GDIView available here that gives a details of GDI objects allocated per process.

这篇关于分析进程中加载​​的本机DLL和程序集的内存占用的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆