Forum: Ruby error when recursively doing hash digests

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Brad T. (Guest)
on 2006-04-07 23:52
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]
This topic is locked and can not be replied to.