From: Mark Hahn Date: 2002-01-16T04:36:35+09:00 Subject: RE: memory usage question I was running under cygwin, but got a decent error message and no crash. That is good news that it is probably not an inherent Ruby problem. -----Original Message----- From: Bill Kelly [mailto:billk@cts.com] Sent: Tuesday, January 15, 2002 11:12 AM To: ruby-talk ML Subject: Re: memory usage question From: "Mark Hahn" > > I need to write a script that will use a hash with 4 million strings of 16 > chars each. As a test I wrote this quick script: > > h = {}; s = 'aaaaaaaaaaaaaaaa' > for i in 1..4_000_000 > h[i] = (s = s.succ) > end > > This ran relatively fast, but it consumed 265 megs of windows memory and > failed with out of memory error at around 3 million elements. > > Why did Ruby fail at 265 megs and is there another way for me to do this? Interesting, I tried it under ruby 1.6.2 (2000-12-18) [i386-cygwin] and got a failure at the same point (~265 megs), but instead of an out-of-memory error, I got: /cygdrive/t/test.rb:5: [BUG] Segmentation fault ruby 1.6.2 (2000-12-18) [i386-cygwin] 0 [sig] ruby 1336 open_stackdumpfile: Dumping stack trace to ruby.exe.stackdump Whereas under ruby 1.6.6 (2001-12-26) [i586-mswin32], the script worked, allocating well over 300M, and completing successfully. That [i586-mswin32] version also completed the task about 20x faster than the cygwin version. . . . My cygwin1.dll is 1003.2.0.0. It would seem cygwin's memory allocation may be subtly broken? Regards, Bill