I have a Ruby app which (on Linux) uses the /proc filesystem to get information on its memory usage. Does anyone know how to get the same information for Mac OSX? The task_info
Taken from http://laurelfan.com/2008/1/15/ruby-memory-usage:
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes
Verified to work in both Linux and OS X.
This returns the number of bytes that the process has resident in memory, excluding any that are swapped out
To get the total virtual memory size including swap, change rss
to vsz
(tested in Linux, but not tested in OSX):
memory_usage = `ps -o vsz= -p #{Process.pid}`.to_i # in kilobytes