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:

How to use?

$ wget
$ ruby ./mem-usage.rb /proc/5952/maps | grep libstd
/usr/lib/x86_64-linux-gnu/ 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.