From: Rob Doug Date: 2009-10-23T02:26:51+09:00 Subject: Re: memory leak > Your number of threads is suspiciously high compared to the 50 threads > that you intend to run. That may be an indication that your code still > suffers the issue that you stuff Thread instances into the Array and > never remove them. Yeah, number of threads confusing me too, but I did as you propose: THREADS = 50 q = SizedQueue.new(THREADS * 2) threads = [] threads = (1..THREADS).map do Thread.new q do |qq| until qq.equal?(myLink = qq.deq) mutex.synchronize do puts $n +=1 # show number of link if ($n % 100) == 0 then print_class_counts # show classes information end end Common2.post_it(myLink) end end end So I just don't understand how amount of threads can be more than 50 > Other than that I cannot see something obvious on first sight. Maybe it > makes more sense to extend the memory dumping to dump only positive > deltas. An alternative is to decrease the dumping interval (e.g. just > after fetching just one URL). > > If you want to throw more on this you could use set_trace_func to > capture invocations of methods named "new" along with the stack trace so > you get the allocation sites. > > Btw, what version of Ruby is this? IIRC there was a bug with > Array#shift up to 1.8.6 which could also cause these effects. ruby 1.8.6 (2008-08-11 patchlevel 287) - it's strange because I've updated it week ago :) -- Posted via http://www.ruby-forum.com/.