ara.t.howard <ara.t.howard / gmail.com> wrote: > On Sep 10, 2008, at 1:45 PM, Joel VanderWerf wrote: > > > It's less dramatic when the entries are not nil (or fixnum etc)--I > > think that's Matt's point. > > > > mb = 2 ** 20 > > > > big = 2 * mb > > > > a = Array.new big do |i| "the string for entry #{i}" end > > b = a.dup > > > > memory_usage = `ps -o rss= -p #{Process.pid}`.to_i > > puts memory_usage > > > > a.zip(b) > > > > memory_usage = `ps -o rss= -p #{Process.pid}`.to_i > > puts memory_usage > > > > __END__ > > 213256 > > 322232 > > true enough - my point is that the block form is much better when the > arrays are big, without it the new array, pointers or not, is created. Definitely relevant, too, since the block form is quite sufficient for the OP's original purpose (and similar stuff where the goal is to process one array in the light of another); thx for bringing out that point. m. -- matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com