[#28015] RCR: RUBY_VERSION_INT — Roger Pack <rogerdpack2@...>

Situation:

14 messages 2010/02/02

[#28113] [Bug #2723] $: length affects re-require time of already loaded files — Greg Hazel <redmine@...>

Bug #2723: $: length affects re-require time of already loaded files

16 messages 2010/02/08

[#28151] [Bug #2739] ruby 1.8.7 built with pthreads hangs under some circumstances — Joel Ebel <redmine@...>

Bug #2739: ruby 1.8.7 built with pthreads hangs under some circumstances

31 messages 2010/02/11

[#28188] [Bug #2750] build fails on win32/MinGW: "executable host ruby is required." even when --with-baseruby is used — Christian Bodt <redmine@...>

Bug #2750: build fails on win32/MinGW: "executable host ruby is required." even when --with-baseruby is used

9 messages 2010/02/16

[#28206] Is Math module a wrapper of libm? — Yusuke ENDOH <mame@...>

Hi matz --

23 messages 2010/02/18
[#28212] Re: Is Math module a wrapper of libm? — Yukihiro Matsumoto <matz@...> 2010/02/18

Hi,

[#28219] Re: Is Math module a wrapper of libm? — Yusuke ENDOH <mame@...> 2010/02/18

Hi,

[#28225] Re: Is Math module a wrapper of libm? — Marc-Andre Lafortune <ruby-core-mailing-list@...> 2010/02/18

Hi,

[#28233] Re: Is Math module a wrapper of libm? — Kenta Murata <muraken@...> 2010/02/18

Hi,

[#28265] Re: Is Math module a wrapper of libm? — Marc-Andre Lafortune <ruby-core-mailing-list@...> 2010/02/20

Hi,

[#28286] Re: Is Math module a wrapper of libm? — Kenta Murata <muraken@...> 2010/02/21

Hi

[#28291] Re: Is Math module a wrapper of libm? — Marc-Andre Lafortune <ruby-core-mailing-list@...> 2010/02/22

Hi!

[#28235] [Feature #2759] Regexp /g and /G options — Michael Fellinger <redmine@...>

Feature #2759: Regexp /g and /G options

35 messages 2010/02/18
[#28459] [Feature #2759] Regexp /g and /G options — caleb clausen <redmine@...> 2010/03/04

Issue #2759 has been updated by caleb clausen.

[#28329] [ANN] Ruby 1.9.2dev has passed RubySpec! — Yusuke ENDOH <mame@...>

Hi,

12 messages 2010/02/24

[#28355] [ANN] Toward rich diversity of Ruby development. — Urabe Shyouhei <shyouhei@...>

A short announcement: thanks to some helps of GitHub people, I now have

12 messages 2010/02/27

[#28365] Indentifying key MRI-on-Windows issues — Jon <jon.forums@...>

In an effort to begin summarizing key MRI-on-Windows open issues I'm starting this thread in hopes that those interested will respond with details on the key MRI issues they feel need resolution for Windows users.

11 messages 2010/02/27
[#28690] Re: Indentifying key MRI-on-Windows issues — Roger Pack <rogerdpack2@...> 2010/03/16

> My key concern is http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/24968

[ruby-core:28106] Re: [Bug #2644] memory over-allocation with regexp

From: Kornelius Kalnbach <murphy@...>
Date: 2010-02-08 12:29:23 UTC
List: ruby-core #28106
On 08.02.10 09:36, Greg Hazel wrote:
> Issue #2644 has been updated by Greg Hazel.
I have a nicer workaround, see below.

> Well, considering other regexp implementations do not have this bug,
>  my guess would be this is either easy or a matter of switching to a
>  better regexp parser, which probably has other benefits.
I think Oniguruma (1.9) is a great Regexp engine. We could redirect the
issue to the author...but that won't fix 1.8. Maybe the problem is on
the Ruby side? JRuby seems to be affected, too:

1
2
Error: Your application used more memory than the safety cap of 500m.
Specify -J-Xmx####m to increase it (#### = cap size in MB).
Specify -w for full OutOfMemoryError stack trace

(The string is only 84 MB.)

On 25.01.10 15:03, Robert Klemme wrote:
> Question is how much the fix costs and how realistic this is.  Even 
> in case there is not a fix, here's an easy workaround for the regular
> expression you presented: avoid backtracking through greediness
> (works on 1.9 and JRuby only): /(\d) (.*+)/
Question is: Why would it backtrack? It doesn't need to. The expressions
are equivalent for this string.

Also, both these expressions need to backtrack, and they work even for
larger strings:

p ' '.*(200_000_000)[/.*?$/].size  #=> 200000000
p ' '.*(200_000_000)[/^.*?$/].size  #=> 200000000

Even this one works:

p ' '.*(200_000_000)[/(.)*/,1].size  #=> 1

All of the above scripts only need about 200 MB of RAM.

Just this breaks it, trying to allocate over 2GiB:

p ' '.*(200_000_000)[/.*/].size
ruby(81051) malloc: *** mmap(size=2348810240) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
test.rb:1:in `[]': Stack overflow in regexp matcher: /.*/ (RegexpError)
	from test.rb:1

Same with + and {0,}. This seems to be a workaround (all Ruby versions):

p ' '.*(200_000_000)[/(?:.)*/].size  #=> 200000000

Ruby is definitely doing something strange here in the background.

> So, I think it should be fixed.
So do I. Actually, how can it be a *Stack overflow*? Quirks like this
tend to hint at bugs or possible optimizations.

Thanks for reading.
[murphy]

In This Thread