Golang: checking open files and memory usage

Notes to myself more than anything, and not really specific to Go (but that’s where I was using it).

To watch the memory usage of a process with pid PID:

while [ 1 ] ; do
  grep VmSize  /proc/PID/status ; sleep 10

To watch the number of file descriptors being used:

while [ 1 ] ; do
  sudo lsof -p PID | wc -l ; sleep 10

Share This


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>