Consider reporting memory usage by mmap

Moved from GitHub dgraph/4573

Posted by mangalaman93:

Currently, we report memory usage (currently in use and memory that could be released to OS but still held back) in alpha logs. The sum of these two memories do not sum up to Resident Memory (RSS) reported by tools such as top or htop. The rest of the memory is generally mmaped mostly by badger in terms the .sst files or .vlog files. It would be useful to report that memory in the logs. The information is generally available in /proc/<pid>/smaps and /proc/<pid>/maps.

mangalaman93 commented :

I wrote a small library for POC GitHub - grandecola/smaps: Script and a library to compute memory usage of a process due to mmap. Note that, we don’t need privileged access to read the /proc/<pid>/smaps for the same process.