0.0
No commit activity in last 3 years
No release in over 3 years
Rack middleware that detect and handle memory leaks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Rack::Leakin

Rack middleware that detect and handle memory leaks

Usage

Add this line to your application's Gemfile:

gem 'rack-leakin'

Then, if you are using Rails, simply add to initializer:

Rails.application.config.middleware.use Rack::Leakin

You can set threshold in kilobytes and the handler:

Rack::Leakin.threshold = 131072 # default, 128MB

For example, it may be useful to send exceptions to Airbrake:

Rack::Leakin.handler = lambda do |env, beginning, ending|
  Airbrake.notify \
    :error_message => "Memory leak detected, from #{beginning}KB to #{ending}KB",
    :error_class   => 'MemoryLeak',
    :parameters => {
      :request_uri => env['REQUEST_URI'],
      :method => env['REQUEST_METHOD']
    }
end