[前][次][番号順一覧][スレッド一覧]

ruby-changes:38469

From: nagachika <ko1@a...>
Date: Wed, 20 May 2015 04:52:33 +0900 (JST)
Subject: [ruby-changes:38469] nagachika:r50550 (ruby_2_2): merge revision(s) 50334, 50337: [Backport #10942]

nagachika	2015-05-20 04:52:07 +0900 (Wed, 20 May 2015)

  New Revision: 50550

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50550

  Log:
    merge revision(s) 50334,50337: [Backport #10942]
    
    * string.c (STR_SET_EMBED): clear NOFREE flag at embedding as
      embedded strings no longer refer static strings.
      [ruby-core:68436] [Bug #10942]

  Added files:
    branches/ruby_2_2/ext/-test-/string/nofree.c
    branches/ruby_2_2/test/-ext-/string/test_nofree.rb
  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/string.c
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 50549)
+++ ruby_2_2/ChangeLog	(revision 50550)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed May 20 04:33:50 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (STR_SET_EMBED): clear NOFREE flag at embedding as
+	  embedded strings no longer refer static strings.
+	  [ruby-core:68436] [Bug #10942]
+
 Wed May 20 03:46:11 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* dir.c (need_normalization): use getattrlist() if fgetattrlist()
Index: ruby_2_2/string.c
===================================================================
--- ruby_2_2/string.c	(revision 50549)
+++ ruby_2_2/string.c	(revision 50550)
@@ -60,7 +60,7 @@ VALUE rb_cSymbol; https://github.com/ruby/ruby/blob/trunk/ruby_2_2/string.c#L60
     FL_SET((str), STR_NOEMBED);\
     STR_SET_EMBED_LEN((str), 0);\
 } while (0)
-#define STR_SET_EMBED(str) FL_UNSET((str), STR_NOEMBED)
+#define STR_SET_EMBED(str) FL_UNSET((str), (STR_NOEMBED|STR_NOFREE))
 #define STR_SET_EMBED_LEN(str, n) do { \
     long tmp_n = (n);\
     RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\
Index: ruby_2_2/ext/-test-/string/nofree.c
===================================================================
--- ruby_2_2/ext/-test-/string/nofree.c	(revision 0)
+++ ruby_2_2/ext/-test-/string/nofree.c	(revision 50550)
@@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/-test-/string/nofree.c#L1
+#include "ruby.h"
+
+VALUE
+bug_str_nofree(VALUE self)
+{
+    return rb_str_new_cstr("abcdef");
+}
+
+void
+Init_nofree(VALUE klass)
+{
+    rb_define_singleton_method(klass, "nofree", bug_str_nofree, 0);
+}

Property changes on: ruby_2_2/ext/-test-/string/nofree.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 50549)
+++ ruby_2_2/version.h	(revision 50550)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-05-20"
-#define RUBY_PATCHLEVEL 109
+#define RUBY_PATCHLEVEL 110
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_2/test/-ext-/string/test_nofree.rb
===================================================================
--- ruby_2_2/test/-ext-/string/test_nofree.rb	(revision 0)
+++ ruby_2_2/test/-ext-/string/test_nofree.rb	(revision 50550)
@@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/-ext-/string/test_nofree.rb#L1
+require 'test/unit'
+
+class Test_StringNoFree < Test::Unit::TestCase
+  def test_no_memory_leak
+    bug10942 = '[ruby-core:68436] [Bug #10942] no leak on nofree string'
+    assert_no_memory_leak(%w(-r-test-/string/string), '',
+                          '1000000.times {Bug::String.nofree << "a" * 100}',
+                          bug10942, rss: true, limit: 2.0)
+  end
+end

Property changes on: ruby_2_2/test/-ext-/string/test_nofree.rb
___________________________________________________________________
Added: svn:eol-style
   + LF


Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50334,50337


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]