On Linux, how do you determine which individual pages are resident?

喜夏-厌秋 提交于 2020-03-21 19:18:08

问题


How can one determine which individual pages are resident (i.e., committed in RAM)? On Linux, /proc/pid/smaps gives, for a fixed set of ranges, how many bytes are resident in that range, but this information doesn't tell you what actual ranges of memory are resident.

As for what this is intended to be used for: I already have data associating allocation ranges with the source line info. This is useful for finding who is allocating how much. Given resident memory ranges, I could correlate the data to find who is allocating how much memory that was being kept resident.

Thanks!


回答1:


There is a syscall to do this:

mincore - determine whether pages are resident in memory

int mincore(void *addr, size_t length, unsigned char *vec);


来源:https://stackoverflow.com/questions/7573418/on-linux-how-do-you-determine-which-individual-pages-are-resident

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!