Skip to content

Instantly share code, notes, and snippets.

@psyho
Created November 2, 2012 11:20
Show Gist options
  • Save psyho/4000318 to your computer and use it in GitHub Desktop.
Save psyho/4000318 to your computer and use it in GitHub Desktop.
Typhoeus 0.4.2 Memory Leak
source :rubygems
# no leak in version 0.3.3
# gem 'typhoeus', '0.3.3'
# memory leaking very fast (1Mb/s) in version 0.4.2
gem 'typhoeus', '0.4.2'
#!/usr/bin/env ruby
require 'rubygems'
require 'typhoeus'
num_requests = 10_000
requests_per_iteration = 5
10_000.times do
hydra = Typhoeus::Hydra.new
requests_per_iteration.times do |i|
hydra.queue(Typhoeus::Request.new("https://www.google.com?q=foo-#{i}"))
end
hydra.run
# not necessary to reproduce, just to show that this not just
# uncollected memory
GC.start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment