Last active
December 10, 2015 07:19
-
-
Save driki/4400443 to your computer and use it in GitHub Desktop.
Memory leak in Net::HTTP.get and non memory leak in HTTPClient.get which I think impacts Anemone https://github.com/NearbyFYI/anemone/blob/next/lib/anemone/http.rb#L136
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
require 'net/http' | |
# Memory continues to climb. | |
idx = 0 | |
loop do | |
begin | |
# Our sample website | |
url = "http://localhost:2000" | |
resp = Net::HTTP.get(URI.parse(url)) | |
puts "run loop: #{idx}" | |
idx += 1 | |
rescue | |
# do nothing | |
end | |
sleep rand(0.1) # just a wait | |
end |
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
require 'nokogiri' | |
require 'httpclient' | |
# Memory use is maintained | |
@@http_client = HTTPClient.new | |
@@http_client.connect_timeout = 60 | |
idx = 0 | |
loop do | |
begin | |
# Our sample website | |
url = "http://localhost:2000" | |
resp = @@http_client.get(url, :follow_redirect => true) | |
puts "run loop: #{idx}" | |
idx += 1 | |
rescue | |
# do nothing | |
end | |
sleep rand(0.1) # just a wait | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment