内存中的DLL大小大小在硬盘上 [英] DLL size in memory & size on the hard disk

查看:138
本文介绍了内存中的DLL大小大小在硬盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内存中的DLL大小和硬盘上的大小之间是否有关系?

Is there a relationship between DLL size in memory and size on the hard disk?

这是因为我正在使用任务管理器扩展(MS),我可以去列表中的EXE,然后右键单击 - > Module,然后我可以看到EXE所使用的所有DLL。它有一个长度列,但是是字节?并且DLL的值(Length)似乎与硬盘上的(DLL)大小不同。为什么?

This is because I am using Task Manager extension (MS), and I can go to an EXE in the list and right click -> Module, then I can see all the DLLs this EXE is using. It has a Length column, but is it in bytes? And the value (Length) of the DLL seems to be different from the (DLL) size on the hard disk. Why?

推荐答案

有一种关系,但并不完全直接或直接。

There's a relationship, but it's not entirely direct or straightforward.

当您的DLL被首次使用时,它被映射到内存。这不会将其加载到内存中,只需在进程中分配一些地址空间,在需要时可以/可以加载它。然后,通过请求分页将DLL的各个页面加载到内存中 - 即,当您引用已分配的一些地址空间时,映射到该地址(或数据)的代码(或数据)将被加载如果它还没有在内存中。

When your DLL is first used, it gets mapped to memory. That doesn't load it into memory, just allocates some address space in your process where it can/could be loaded when/if needed. Then, individual pages of the DLL get loaded into memory via demand paging -- i.e., when you refer to some of the address space that got allocated, the code (or data) that's mapped to that/those address(es) will be loaded if it's not already in memory.

现在,地址映射占用了一点空间(每个兆字节地址空间映射的4K页)。当然,当您将一些数据加载到内存中时,也会占用内存。

Now, the address mapping does take up a little space (one 4K page for each megabyte of address space that gets mapped). Of course, when you load some data into memory, that uses up memory too.

但是,请注意,大多数页面可以/也将在进程之间共享,因此如果您的DLL由5个不同的进程一次使用,它将被映射5次(即,一次使用它的每个进程),但内存中仍然只有一个物理副本(至少通常)。

Note, however, that most pages can/will be shared between processes too, so if your DLL was used by 5 different processes at once, it would be mapped 5 times (i.e., once to each process that used it) but there would still only be one physical copy in memory (at least normally).

在这些之间,一个特定的DLL的内存消耗正是你的意思,甚至有点困难。

Between those, it can be a little difficult to even pin down exactly what you mean by the memory consumption of a particular DLL.

这篇关于内存中的DLL大小大小在硬盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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