From: "Mauricio Fernández" Date: 2004-08-01T02:59:48+09:00 Subject: [PATCH] Infinite recursion in rdoc While generating Borges' rdoc documentation, rdoc began to demand in excess of 700MB RAM (before I killed it, that is ;). This is the rdoc shipped with ruby 1.8.2 (2004-07-30). A typical backtrace would be: /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:310:in `toplevel': Interrupt from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' from /home/batsman/usr//lib/ruby/1.8/rdoc/code_objects.rb:328:in `find_symbol' ... 89803 levels... from /home/batsman/usr//lib/ruby/1.8/rdoc/generators/html_generator.rb:1210:in `generate_html' from /home/batsman/usr//lib/ruby/1.8/rdoc/generators/html_generator.rb:1130:in `generate' from /home/batsman/usr//lib/ruby/1.8/rdoc/rdoc.rb:269:in `document' from /home/batsman/usr//bin/rdoc:63 The trivial patch below makes sense and once applied the problem went away: diff -ru ruby.orig/lib/rdoc/code_objects.rb ruby/lib/rdoc/code_objects.rb --- ruby.orig/lib/rdoc/code_objects.rb 2004-07-31 19:43:55.000000000 +0200 +++ ruby/lib/rdoc/code_objects.rb 2004-07-31 19:44:37.000000000 +0200 @@ -325,7 +325,7 @@ result = nil case symbol when /^::(.*)/ - result = toplevel.find_symbol(symbol) + result = toplevel.find_symbol($1) when /::/ modules = symbol.split(/::/) unless modules.empty? -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com