c - 在 Windows 上获取 C 中的总交换大小?

标签 c windows swap ram

我知道如何使用 GlobalMemoryStatus( ) 和 GlobalMemoryStatusEx( ) 获取总 RAM,但如何使用 C 编程获取 Windows 上的总交换空间大小?

最佳答案

有关获取页面文件使用和限制的信息在 MEMORYSTATUSEX structure 的文档中.

ullTotalPageFile

The current committed memory limit for the system or the current process, whichever is smaller, in bytes. To get the system-wide committed memory limit, call GetPerformanceInfo.

ullAvailPageFile

The maximum amount of memory the current process can commit, in bytes. This value is equal to or smaller than the system-wide available commit value. To calculate the system-wide available commit value, call GetPerformanceInfo and subtract the value of CommitTotal from the value of CommitLimit.

GetPerformanceInfo填充 PERFORMANCE_INFORMATION结构,文档列出了它包含的所有字段。

MSDN 也有一个名为 Memory Performance Information 的概述。 .

关于c - 在 Windows 上获取 C 中的总交换大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27971475/

相关文章:

algorithm - 如何找到两个不同排列之间的最短交换序列?

CS50 复数无法编译

c++ - 我正在尝试使用队列实现 bfs。有人可以帮我找到错误吗?

java - 两个用不同语言编写的应用程序可以通信吗?

postgresql - 为什么 Postgres 中的表交换如此冗长?

c++ - 如何将 `swap` 专门用于具有位域成员的类?

c - 如何从位于/usr/include 的 Linux 头文件中获取函数名称

windows - 我是否应该创建一个新的存储帐户专门用于存储 Azure 诊断数据?

python - Windows 下 Python 3.x 的 OpenCV

windows - 如何在 Windows 中更改 Git 终端的标题?