系统总内存消耗

发布于 2024-07-23 12:02:07 字数 71 浏览 5 评论 0原文

假设系统的总内存消耗(虚拟 + 物理)是 Windows 中任务管理器显示的“内存使用情况”和“VM 大小”列的总和,是否正确?

Is it correct to assume that the total memory consumption (virtual + physical) of a system is sum of "Memory Usage" and "VM Size" columns shown by the task manager in windows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

往日情怀 2024-07-30 12:02:07

在现代 Windows 中,关于“总内存消耗”确实没有单一的事实。 这当然取决于定义,但真正的问题是你想用答案做什么。

某些进程(例如 SQL-Server)倾向于使用它们能够获得的所有内存字节(如果您允许的话)。 .NET CLR 垃圾收集器监视内存使用情况并采取相应措施,在内存不足时尝试释放更多内存。

例如,您可以拥有一个具有 8 GB 物理内存的系统,其中 90% 已“使用”。 实际上需要多少内存,很难说。 相同的系统可以在 4 GB 计算机上运行,​​不会出现明显的性能损失或任何其他问题。

如果您想探索 Windows 下内存管理的一些复杂性,请下载 "VMMap v2.0” 来自以前的 sysinternals 站点。 它显示了每个进程非常详细的内存使用情况,可能会帮助您完成任务。

引用 VMMaps 帮助:
VMMap 将内存分为以下几种类型之一:

图像
内存代表可执行文件,例如 .exe 或 .dll。 详细信息列显示文件的路径。

私人
私有内存不能与其他进程共享,根据系统提交限制收费,并且通常包含应用程序数据。

可分享
可共享内存可以与其他进程共享,根据系统提交限制进行计费,并且通常包含不同进程中的 DLL 之间共享的数据或进程间通信消息。 Windows API 将这种类型的内存称为页面文件支持的部分。

映射文件
内存代表磁盘上的文件,详细信息列显示文件的路径。 映射文件通常包含应用程序数据。


堆表示由用户模式堆管理器管理的内存,与私有内存一样,根据系统提交限制收费并包含应用程序数据。

托管堆
托管堆表示由 .NET 垃圾收集器分配和使用的内存。

堆栈
堆栈是用于存储各个线程的函数参数、局部函数变量和函数调用记录的内存。 堆栈按提交限制收费,并且通常按需增长。

系统
系统内存是与进程关联的内核模式物理内存。 绝大多数系统内存由进程页表组成。

免费
空闲内存区域是进程地址空间中未分配的空间。

现在,您只需要定义您认为“已使用”的内存类型,将所有进程的这些内存相加,删除多个重复项并查看数量...在任务管理器或其他工具中,没有任何内存类型是有原因的标有“总内存消耗”的单个数字:-)

In modern Windows there really is no single truth about "Total Memory Consumption". It depends of course on the definition, but the real question is what you want to do with the answer.

Some processes like SQL-Server tend to use every byte of memory they can get their hands on, if you let them. The .NET CLR garbage collector monitors memory use and acts accordingly, trying to free more memory when it gets scarce.

So for instance you can have a system with 8 GB of physical memory, of which 90% is "used". How much of that memory is actually needed, is very hard to say. The same system may run on a 4 GB machine with no noticeable performance loss or any other issues.

If you want to explore some of the complexities of memory management under Windows, download "VMMap v2.0" from the former sysinternals site. It shows very detailed memory usage per process and may aid you in your quest.

To quote from VMMaps Help:
VMMap categorizes memory into one of several types:

Image
The memory represents an executable file such as a .exe or .dll. The Details column shows the file's path.

Private
Private memory cannot be shared with other processes, is charged against the system commit limit, and typically contains application data.

Shareable
Shareable memory can be shared with other processes, is charged against the system commit limit and typically contains data shared between DLLs in different processes or inter-process communication messages. The Windows APIs refer to this type of memory as pagefile-backed sections.

Mapped File
The memory represents a file on disk and the Details column shows the file's path. Mapped files typically contain application data.

Heap
Heaps represent memory managed by the user-mode heap manager and, like Private memory, is charged against the system commit limit and contains application data.

Managed Heap
Managed heap represents memory that's allocated and used by the .NET garbage collector.

Stack
Stacks are memory used to store function parameters, local function variables and function invocation records for individual threads. Stacks are charged agains the commit limit and typically grow on demand.

System
System memory is kernel-mode physical memory associated with the process. The vast majority of System memory consists of the process page tables.

Free
Free memory regions are spaces in the process address space that are not allocated.

Now you just need to define what types of memory you consider as "used", add these up for all processes, remove multiple duplicates and look at the number... There is a reason why in task manager or other tools, there is no single number labeled "Total Memory Consumption" :-)

初懵 2024-07-30 12:02:07

不可以,物理内存和虚拟内存可能会重叠。 如果内存页面位于虚拟内存中,然后被分页到物理内存中,则虚拟内存不一定会被释放,它可能会被保留以供该页面再次调出时使用。

No, physical memory and virtual memory may overlap. If a page of memory is in virtual memory and then paged in to physical memory the virtual memory is not necessarily freed, it may be reserved for when the page gets paged out again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文