On Wed, 11 Apr 2007 02:28:33 +0900, "Luis Parravicini" <lparravi / gmail.com> wrote:
> grepping the ruby source shows regex.c is the only file with that
> string. And thats how far I got. Any ideas?

The error is coming from the parser.  Here's a simpler test case using integers:

 eval <<EOS
   case x
   #{ (0..2498).map { |n| "when #{n}: nil\n" }.join('') }
   end
 EOS

We know that it's happening at parse-time rather than run-time, because the out-of-memory error occurs before Ruby has a chance to complain that 'x' is undefined.

In short, the Ruby parser apparently cannot cope with case statements which have more than 2498 branches (at least with the build of Ruby I've got here, changing 2498 to 2497 is enough to avoid the memory issue).

-mental