Closed
Description
Summary
- OS: Linux
- Type: performance
Description
Current Process().memory_full_info()
reads /proc/<pid>/smaps
, and then sums across maps. This can be slow if there are many maps.
Linux provides a /proc/<pid>/smaps_rollup
that is the information in smaps
summarized across the whole process: exactly what this function is calculating. For processes with large number of mmaps, using this file directly would reduce the cost of memory_full_info()
significantly.
This was apparently added to Linux sometime in 2017 or 2018.
It's the same format, so you could the exact same code, even, just open that file instead if it exists.