From: Rob Doug Date: 2009-10-24T06:28:40+09:00 Subject: Re: memory leak Well, seems I found solution... I tried to make some test on python as well. Simple script, previously posted, eat memory on python too... and the only way I had it to use forks. I checked out forkoff, but produce some strange bugs. This is the working code: threads = (1..THREADS).map do Thread.new q do |qq| until qq.equal?(myLink = qq.deq) mutex.synchronize do puts ($n +=1).to_s # + " : " + print_class_counts.to_s end fork # <----- You need to fork it, after exit fork will release memory begin agent = WWW::Mechanize.new{ |agent| agent.history.max_size=1 agent.open_timeout = 20 agent.read_timeout = 40 agent.user_agent_alias = 'Windows IE 7' agent.keep_alive = false } page = agent.get(myLink) puts myLink puts page.forms.length page.forms.each do |form| end rescue end end end end end -- Posted via http://www.ruby-forum.com/.