The method I was using was essentially grep VmRSS /proc/$pid/status Comparing these two methods, I get Your method (PSS): 2408313 My method (RSS): VmRSS: 2410396 kB On Oct 21, 2015, at 12:29 AM, Tom Zander wrote: > On Tuesday 20 Oct 2015 20:01:16 Jonathan Toomim wrote: > Please make sure you measure your memory usage correctly on Linux, it is > notoriously easy to get misleading info from tools like top. > > I use this one on Linux. > > $cat ~/bin/showmemusage > #!/bin/sh > if test -z "$1"; then > echo "need a pid" > exit > fi > > mem=`echo 0 $(cat /proc/$1/smaps | grep Pss | awk '{print $2}' | \ > sed 's#^#+#' ) | bc` > echo "$mem KB"