From: patrick-may@... (Patrick May)
Date: 2002-05-23T05:40:55+09:00
Subject: possible bug: stack dump with <<-String, #{...} and large loops
I had (poorly) coded a #{} with a large loop, i.e.
def html
<<-HTML
This is super ugly....
#{ html = ""
LargeCollection.each { |item|
html += item.html
}
html }
HTML
end
Now, besides the fact that this is very ugly, it appeared to be
causing core dumps:
16:21:43 /cygdrive/d/src
% runtest.rb admin.rb
.................................................................................
............../coverage.rb:220: [BUG] Segmentation fault
ruby 1.6.4 (2001-06-04) [i386-cygwin]
0 [sig] ruby 292 open_stackdumpfile: Dumping stack trace to
ruby.exe.stack
dump
Aborted (core dumped)
16:22:06 /cygdrive/d/src
%
I got this core dump at different line numbers in my application until
I corrected the above structure to be
def html
content = ""
LargeCollection.each { |item|
html += item.html
}
<<-HTML
This is super ugly....
#{ content }
HTML
end
Is this a known problem?
~ Patrick