segfault while using regex in an infinite loop
While learning ruby, I noticed that Regex matches were kept in memory to be able to access groups elements
with $1, $2, and so on later in the code.
So I wondered if this could fill my memory, and tried the following code:
s = "a" while true do s = s*2 s[/a+/] end
Which lead to a segmentation fault.
(here is the full backtrace from irb: http://www.ideone.com/kNioo )
I first thought that it was because my "s" variable was getting bigger and bigger, but after a simple
test I noticed that it threw an ArgumentError.
Shouldn't this throw an exception too? so it could be caught in the code.
If I missed something (as said, i'm really new to ruby) and this report is pointless, I'm sorry,
otherwise I hope it will be useful.