Skip to content

Instantly share code, notes, and snippets.

@alyssais
Created April 18, 2017 14:46
Show Gist options
  • Save alyssais/b1990f3ccc62c2c40fac08e34c3bd0ab to your computer and use it in GitHub Desktop.
Save alyssais/b1990f3ccc62c2c40fac08e34c3bd0ab to your computer and use it in GitHub Desktop.
Investigating a potential memory leak in the Rugged gem
require "rugged"
def diff_parents(commit)
puts commit.oid
commit.parents.each { |parent| parent.diff(commit) }
commit.parents.each { |parent| diff_parents(parent) }
rescue SystemStackError
end
path = "#{__dir__}/rails"
if File.directory?(path)
repo = Rugged::Repository.new(path)
else
print "Cloning rails…"
repo = Rugged::Repository.clone_at("https://github.com/rails/rails", path)
puts " done"
end
diff_parents repo.head.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment