len = 1
while true
a = {“test”=>‘x’*len}
puts len
b = YAML.dump(a)
len += 1
end
I’ve tried two different machines; The magic number of one is 4103 and
the
other is 4175
This is coincidentally close to a 4k buffer perhaps???
This happens on cygwin:
8187
8188
8189
8190
8191
8192
/usr/lib/ruby/1.8/yaml/rubytypes.rb:315:in simple': failed to allocate memory ( NoMemoryError) from /usr/lib/ruby/1.8/yaml/rubytypes.rb:315:in to_yaml’
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:293:in call' from /usr/lib/ruby/1.8/yaml.rb:188:in quick_emit’
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:293:in to_yaml' from /usr/lib/ruby/1.8/yaml/baseemitter.rb:175:in map’
from /usr/lib/ruby/1.8/yaml/baseemitter.rb:164:in each' from /usr/lib/ruby/1.8/yaml/baseemitter.rb:164:in map’
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:60:in to_yaml' from /usr/lib/ruby/1.8/yaml/rubytypes.rb:55:in call’
from /usr/lib/ruby/1.8/yaml.rb:188:in quick_emit' from /usr/lib/ruby/1.8/yaml/rubytypes.rb:55:in to_yaml’
from /usr/lib/ruby/1.8/yaml.rb:31:in `dump’
from ./yaml-bug.rb:10