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

ruby-changes:35126

From: ktsj <ko1@a...>
Date: Sun, 17 Aug 2014 19:51:48 +0900 (JST)
Subject: [ruby-changes:35126] ktsj:r47208 (trunk): * gc.c (obj_memsize_of): don't calculate memsize of T_NODE

ktsj	2014-08-17 19:51:33 +0900 (Sun, 17 Aug 2014)

  New Revision: 47208

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

  Log:
    * gc.c (obj_memsize_of): don't calculate memsize of T_NODE
      when called from check_gen_consistency. It fixes segmentation
      fault on RGENGC_CHECK_MODE >= 1 introduced by r47188.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47207)
+++ ChangeLog	(revision 47208)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Aug 17 19:41:40 2014  Kazuki Tsujimoto  <kazuki@c...>
+
+	* gc.c (obj_memsize_of): don't calculate memsize of T_NODE
+	  when called from check_gen_consistency. It fixes segmentation
+	  fault on RGENGC_CHECK_MODE >= 1 introduced by r47188.
+
 Sun Aug 17 17:08:12 2014  Masaki Suketa <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole.c (ole_invoke): use RHASH_SIZE instead of
Index: gc.c
===================================================================
--- gc.c	(revision 47207)
+++ gc.c	(revision 47208)
@@ -690,7 +690,7 @@ static void gc_mark(rb_objspace_t *objsp https://github.com/ruby/ruby/blob/trunk/gc.c#L690
 static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr);
 static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
 
-static size_t obj_memsize_of(VALUE obj, int use_tdata);
+static size_t obj_memsize_of(VALUE obj, int use_all_types);
 static VALUE gc_verify_internal_consistency(VALUE self);
 
 static double getrusage_time(void);
@@ -2497,7 +2497,7 @@ size_t rb_generic_ivar_memsize(VALUE); https://github.com/ruby/ruby/blob/trunk/gc.c#L2497
 #include "regint.h"
 
 static size_t
-obj_memsize_of(VALUE obj, int use_tdata)
+obj_memsize_of(VALUE obj, int use_all_types)
 {
     size_t size = 0;
 
@@ -2557,7 +2557,7 @@ obj_memsize_of(VALUE obj, int use_tdata) https://github.com/ruby/ruby/blob/trunk/gc.c#L2557
 	}
 	break;
       case T_DATA:
-	if (use_tdata) size += rb_objspace_data_type_memsize(obj);
+	if (use_all_types) size += rb_objspace_data_type_memsize(obj);
 	break;
       case T_MATCH:
 	if (RMATCH(obj)->rmatch) {
@@ -2590,7 +2590,7 @@ obj_memsize_of(VALUE obj, int use_tdata) https://github.com/ruby/ruby/blob/trunk/gc.c#L2590
 	break;
 
       case T_NODE:
-	size += rb_node_memsize(obj);
+	if (use_all_types) size += rb_node_memsize(obj);
 	break;
 
       case T_STRUCT:

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

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