kzk / unicorn-worker-killer

Automatically restart Unicorn workers based on 1) max number of requests and 2) max memory

Home Page:https://rubygems.org/gems/unicorn-worker-killer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get RSS without forking on MacOS X or Windows

skull-squadron opened this issue · comments

OSX: It appears ps is signed or whitelisted to allow some syscalls, possibly including task_for_pid

Simple test:

Regular ps

$ ps -opid,rss
  PID    RSS
50351   5040
81222   6028
22750   5008
24728    540
24729    540
56332   2600
52229   4864

Copy of ps

$ cp /bin/ps ~/bin_ps && ~/bin_ps -opid,rss && rm ~/bin_ps
  PID    RSS
50351      0
81222      0
22750      0
24728      0
24729      0
56332      0
52229      0
56699    548

pull request are welcomed. the current committers assume that this gem is used at Linux on production environment.

TL;DR: Reading RSS from another pid is likely not possible on OSX.