module Memstat::OobGC::Unicorn

Public Class Methods

new(app, threshold = (1024**3)) click to toggle source
# File lib/memstat/oob_gc/unicorn.rb, line 4
def self.new(app, threshold = (1024**3))
  self.const_set :OOBGC_THRESHOLD, threshold
  app # pretend to be Rack middleware since it was in the past
end

Public Instance Methods

process_client(client) click to toggle source
Calls superclass method
# File lib/memstat/oob_gc/unicorn.rb, line 9
def process_client(client)
  super(client) # Unicorn::HttpServer#process_client

  if Memstat.linux?
    status = Memstat::Proc::Status.new(:pid => Process.pid)

    if status.rss > OOBGC_THRESHOLD
      GC.start
    end
  end
end