Error when recursively doing hash digests


#1

I get the following error sometimes:

ruby(11294) malloc: *** vm_allocate(size=20484096) failed (error code=3)
ruby(11294) malloc: *** error: can’t allocate region
ruby(11294) malloc: *** set a breakpoint in szone_error to debug

When doing this recursively on many files:

                           begin
                                    File.open(file, 'rb') do |io|
                                            buf = ""
                                            calc = 

Digest::const_get(algorithm.upcase).new
while
io.read(20_480_000, buf)
calc.update(buf)
end
info = calc.to_s + " " + file
puts info
end
rescue
end

ruby 1.9.0 (2006-04-06) [powerpc-darwin8.6.0]