Bug #1063: in `write': Not enough space - <STDOUT> (Errno::ENOMEM) on Windows XP
http://redmine.ruby-lang.org/issues/show/1063

Author: Nick Gorbikoff
Status: Open, Priority: Normal
Category: core, Target version: 1.9.1

Hi, All.

I'm getting an error message when running my test codes on Windows XP under latest ruby-1.9.1-preview - that I downloaded of the website in binary form ( I didn't compile it).

<pre><code class="ruby">
test.rb:34:in `write': Not enough space - <STDOUT> (Errno::ENOMEM)
        from test.rb:34:in `puts'
        from test.rb:34:in `puts'
        from test.rb:34:in `<main>'
</code></pre>


Now the error message I'm getting is strange - all I could find about it is actually - that somebody had it on *nix machines, but not on windows. Also the same code runs fine under my ruby-1.8.6 - patch 111. As I understand that code means that it's a running out of swap space. Well there is a pagefile on windows, which I guess I guess is windows swap equivalent, but I'm running on a fairly fast machine ( dual core pent 4, with 4 gbs of RAM and system managed pagefile.) So I don't think I'm actually running of memory. :-)

Below is my code that I run ( mind it's just a stupid benchmark code - there is no utility to it, but I was surprised that 1.9.1 couldn't handle what 1.8.6 did) :


<pre><code class="ruby">
a = Time.now
k = []

class Array
  def inject(n)
     each { |value| n = yield(n, value) }
     n
  end
  def sum
    inject(0) { |n, value| n + value }
  end
  def product
    inject(1) { |n, value| n * value }
  end
end

def fibUpTo(max)
  i1, i2 = 1, 1        # parallel assignment
  while i1 <= max
    yield i1
    i1, i2 = i2, i1+i2
  end
end

fibUpTo(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) { |f| k.push(f) }
puts "k is: "
puts k
s = k.sum
p = k.product
puts "s is: "
puts s

puts "p is: "
puts p

b = Time.now

c = b-a
puts c
puts "it took: " + c.to_s + " seconds to complete"

</code></pre>


----------------------------------------
http://redmine.ruby-lang.org