# Error when recursively doing hash digests

**URL:** <https://www.ruby-forum.com/t/error-when-recursively-doing-hash-digests/57203>\
**Category:** Ruby\
**Created:** [April 7, 2006, 9:52pm UTC](https://www.ruby-forum.com/t/error-when-recursively-doing-hash-digests/57203 "2006-04-07T21:52:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brad7a0](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/53a042/32.png) [@brad7a0](https://www.ruby-forum.com/u/brad7a0)\
**Post date:** [April 7, 2006, 9:52pm UTC](https://www.ruby-forum.com/t/error-when-recursively-doing-hash-digests/57203/1 "2006-04-07T21:52:30Z")

</div>

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]
