Skip to content

Instantly share code, notes, and snippets.

@maxivak
Last active December 22, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxivak/6515847 to your computer and use it in GitHub Desktop.
Save maxivak/6515847 to your computer and use it in GitHub Desktop.
Rails. Disable GC during request
class ApplicationController < ActionController::Base
around_filter :gc_disable
private
def gc_disable
GC.disable
begin
yield
ensure
GC.enable
GC.start
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment