在Linux的进程使用的内存页 [英] Memory pages used by a process in Linux

查看:126
本文介绍了在Linux的进程使用的内存页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时一个Linux进程的所有页映射(分配的内存)的列表。我该怎么做?

I want to get the list of all mapped pages (allocated memory) in a Linux Process at runtime. How can I do that?

推荐答案

从进程中,在Linux上,你可以阅读和解析的/ proc /自/图;尝试执行cat / proc /自/图,它会显示你的程序的运行内存映射,

From inside the process, on Linux, you can read and parse /proc/self/maps ; try cat /proc/self/maps which will show you the memory map of the process running that cat

从另一个进程,为PID 1234过程的地图,你可以阅读的/ proc / 1234 /图

From another process, for the map of the process of pid 1234, you can read /proc/1234/maps

和还有的/ proc /自/ smaps 等。

Linux的具体提供dladdr 功能有时也有用。

The Linux specific dladdr function is sometimes useful also.

如果您是通过哪些是真正的RAM,使用和mincore &放页有关; 则msync

If you are concerned by pages which are really in RAM, use mincore & msync

这篇关于在Linux的进程使用的内存页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆