Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created March 30, 2013 21:20
Show Gist options
  • Save myronmarston/5278382 to your computer and use it in GitHub Desktop.
Save myronmarston/5278382 to your computer and use it in GitHub Desktop.
Debug SystemStackError with this utility file.
max_stack_frames = 500
TooManyStackFrames = Class.new(StandardError)
set_trace_func proc { |event, file, line, id, binding, classname|
if event == "call" && caller.size >= max_stack_frames
raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment