系统的总内存消耗

时间:2020-11-28 16:57:15

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?

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

3 个解决方案

#2


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.

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

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.

像SQL-Server这样的某些进程倾向于使用他们可以获取的每个内存字节,如果你允许的话。 .NET CLR垃圾收集器监视内存使用并相应地执行操作,尝试在内存不足时释放更多内存。

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.

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

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.

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

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

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

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

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

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.

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

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.

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

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" :-)

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

#3


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.

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

#1


#2


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.

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

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.

像SQL-Server这样的某些进程倾向于使用他们可以获取的每个内存字节,如果你允许的话。 .NET CLR垃圾收集器监视内存使用并相应地执行操作,尝试在内存不足时释放更多内存。

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.

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

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.

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

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

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

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

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

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.

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

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.

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

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" :-)

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

#3


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.

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