From: Michael Bevilacqua-Linn Date: 2008-01-09T12:53:17+09:00 Subject: Re: why does this code leak? ------=_Part_45724_15608586.1199850800367 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Why are you assuming it's leaking without giving the GC a chance to run? require 'net/http' 3.times do Net::HTTP.start('www.google.com') do |http| http_response = http.get '/' end p ObjectSpace.each_object(Net::HTTPResponse){} end p "Force GC" ObjectSpace.garbage_collect p ObjectSpace.each_object(Net::HTTPResponse){} C:\>ruby test.rb 1 2 3 "Force GC" 0 MBL On Jan 8, 2008 10:23 PM, ara howard wrote: > cfp2:~ > cat a.rb > #! /usr/bin/env ruby > > require 'net/http' > > 3.times do > Net::HTTP.start('www.google.com') do |http| > http_response = http.get '/' > end > > p ObjectSpace.each_object(Net::HTTPResponse){} > end > > > cfp2:~ > ruby a.rb > 1 > 2 > 3 > > > why is this leaking Net::HTTPResponse objects? > > > a @ http://codeforpeople.com/ > -- > share your knowledge. it's a way to achieve immortality. > h.h. the 14th dalai lama > > > > ------=_Part_45724_15608586.1199850800367--