Memory consumption by a .so file for a running process

I wanted to know how much memory is consumed by C++ standard library for a process running on Linux. There is no straightforward way I could find so I have written a small script to do exactly that.

Script Location: https://gist.github.com/4215536

How to use?


$ wget https://raw.github.com/gist/4215536/6ae899f454fd72ba3b6202724e15f855f80e33b3/mem-usage.rb
$ ruby ./mem-usage.rb /proc/5952/maps | grep libstd
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16: 2988.0 KBs

In the above example, 5952 is the PID of Thunderbird mail client and C++ standard library consumes 2988 KB of memory for this process.

About these ads