On Tue, Jun 12, 2007 at 11:25:04PM +0900, Robert Klemme wrote: > On 12.06.2007 16:16, Florian Frank wrote: > >Robert Klemme wrote: > >>I believe it's the star operator: > >> > >>13:10:22 [Temp]: ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 1000000 > >>13:10:35 [Temp]: ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 10000000 > >>-e:1: [BUG] Segmentation fault > >>ruby 1.8.6 (2007-03-13) [i386-cygwin] [...] > >The reason for this problem is, that the stack is used to pass A LOT of > >arguments to the Hash.[] method. If the stack size of the executed process > >isn't > >big enough (check your resource limits), this can lead to crashes. > > That was what I was guessing. However, I haven't enough insight to > verify. There is at least one point that causes me doubt: the array can > be handled and stored like any other array, so it should be on the heap > (or it is implicitly moved there). $ ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 2091000 -e:1:in `[]': stack level too deep (SystemStackError) from -e:1 $ ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 2092000 Segmentation fault $ ulimit -s 8192 $ ulimit -s 16384 $ ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 2092000 $ ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 4184000 -e:1:in `[]': stack level too deep (SystemStackError) from -e:1 $ ruby -e 'Hash[*Array.new(ARGV.shift.to_i) ]' 4190000 Segmentation fault -- Mauricio Fernandez - http://eigenclass.org - singular Ruby