From: Kenneth McDonald Date: 2007-08-31T10:35:26+09:00 Subject: Re: Why stack overflow with such a small stack? Daniel DeLorme wrote: > Kenneth McDonald wrote: >> I'm getting the following error: >> >> sheet.rb:35:in `values': stack level too deep (SystemStackError) >> from sheet.rb:35:in `values' >> from sheet.rb:53:in `to_s' >> from sheet.rb:52:in `to_s' >> from sheet.rb:52:in `map' >> from sheet.rb:52:in `to_s' >> from sheet.rb:52:in `to_s' >> from sheet.rb:52:in `map' >> from sheet.rb:52:in `to_s' >> from sheet.rb:52:in `to_s' >> from sheet.rb:52:in `map' >> from sheet.rb:52:in `to_s' >> from sheet.rb:92 >> >> The output above is given _in full_. Is Ruby truncating the call >> stack in this output? If so, how I can I see a larger snapshot of >> the stack, so I can trace down where the infinite recursion is really >> happening? If not, why am I getting this error? > > Here's one even shorter: > >> def x; x; end; x > SystemStackError: stack level too deep > from (irb):2:in `x' > from (irb):2:in `x' > from (irb):4 > > Pretty smart of ruby to avoid a gazillion lines of identical output IMHO > > Daniel > > To a newcomer, it's sorta nonobvious, however--it turned out the problem was that I'd made a circular reference to 'values' instead of '@values', and the fact that the stack was full of 'values' frames is certainly not obvious from the above. Ken