diff --git a/ChangeLog b/ChangeLog index 832e599368..c108a69d98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jul 14 00:10:15 2006 Yukihiro Matsumoto + + * array.c (rb_ary_pop): may cause realloc oscillation. a patch + from MORITA Naoyuki . + [ruby-dev:29028] + Thu Jul 13 22:23:56 2006 Hidetoshi NAGAI * ext/tk/lib/tk/composite.rb: improve handling of the classname on the diff --git a/array.c b/array.c index 708a4900c0..5bf0e9979d 100644 --- a/array.c +++ b/array.c @@ -454,7 +454,7 @@ rb_ary_pop(VALUE ary) rb_ary_modify_check(ary); if (RARRAY(ary)->len == 0) return Qnil; if (!FL_TEST(ary, ELTS_SHARED) && - RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa && + RARRAY(ary)->len * 3 < RARRAY(ary)->aux.capa && RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) { RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2; REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);