The memory your Ruby process is taking
Today I learned how to get the memory taken by a Ruby process from inside a Ruby code:
def mem
`ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split[1] + ' KB'
end
mem
# => "61772 KB"
By the way in Ruby $$
is the same as Process.pid
.