Created
November 2, 2012 11:20
-
-
Save psyho/4000318 to your computer and use it in GitHub Desktop.
Typhoeus 0.4.2 Memory Leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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