在Linux上,如何确定驻留哪些单独的页面? [英] On Linux, how do you determine which individual pages are resident?
问题描述
一个人如何确定驻留哪些页面(即在RAM中提交)?在Linux上,/proc/pid/smaps会为一组固定范围提供该范围内驻留的字节数,但是此信息并不能告诉您实际驻留的内存范围是什么.
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.
谢谢!
推荐答案
有一个系统调用可以做到这一点:
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);
这篇关于在Linux上,如何确定驻留哪些单独的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!