简体   繁体   中英

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

How can one determine which individual pages are resident (ie, 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!

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM