c++ - Linux 中单个进程的总/可用虚拟内存

标签 c++ linux memory virtual

我需要监控:

  • 物理内存
  • 交换内存
  • 虚拟内存

当前进程。总和可用(免费)。

使用 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 and ullAvailVirtual from Windows MEMORYSTATUSEX structure from GlobalMemoryStatus() on Linux systems.

最佳答案

几周前发布了以下小型库:https://sourceforge.net/projects/meminfo/

也许它有助于解决你的问题

关于c++ - Linux 中单个进程的总/可用虚拟内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30592762/

相关文章:

java - 将java内存限制为64MB

python - 如何记录 python MemoryError(当我内存不足时)

c++ - windows下如何设置Qt程序的图标?

c++ - 在 Ubuntu 11.10 上编译 C++ 和 OpenSSL

c - Xlinker 输入参数在 Linux 中不起作用

regex一个数字重复n次以上符合grep

java - 如何使用 Spark 将对象永久保存在内存中?

c++ - 为什么重载的 ' operator < ' 应该是类的常量?

c++ - 是否接受从派生 const 到非常量父类的隐式转换?

linux - RedHat 5 - pstack 和 gdb