我需要监控:
- 物理内存
- 交换内存
- 虚拟内存
当前进程。总和可用(免费)。
使用 sysinfo
结构我可以毫无问题地获得物理和交换空间,我可以从 e.x. /proc/self/statm
...
...but I still need total and/or free virtual memory for the current process. How to accomplish this?
这纯粹是与 Linux 相关的问题(在 Win 中很容易)。使用的发行版:Ubuntu、Fedora。
EDIT: Maybe it will be easier to understand my question, when I say that I'm trying to acquire equivalent of
ullTotalVirtual
andullAvailVirtual
from Windows MEMORYSTATUSEX structure from GlobalMemoryStatus() on Linux systems.
最佳答案
几周前发布了以下小型库:https://sourceforge.net/projects/meminfo/
也许它有助于解决你的问题
关于c++ - Linux 中单个进程的总/可用虚拟内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30592762/