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

ruby-changes:32087

From: ko1 <ko1@a...>
Date: Fri, 13 Dec 2013 12:02:12 +0900 (JST)
Subject: [ruby-changes:32087] ko1:r44166 (trunk): * gc.c (garbage_collect_body): use rb_bug() and explicit error message

ko1	2013-12-13 12:02:03 +0900 (Fri, 13 Dec 2013)

  New Revision: 44166

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

  Log:
    * gc.c (garbage_collect_body): use rb_bug() and explicit error message
      instead of using assert().
      [Bug #9222]

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44165)
+++ ChangeLog	(revision 44166)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec 13 12:01:07 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (garbage_collect_body): use rb_bug() and explicit error message
+	  instead of using assert().
+	  [Bug #9222]
+
 Fri Dec 13 11:52:41 2013  Koichi Sasada  <ko1@a...>
 
 	* array.c: fix comment to remove the word "shady".
Index: gc.c
===================================================================
--- gc.c	(revision 44165)
+++ gc.c	(revision 44166)
@@ -4940,6 +4940,7 @@ garbage_collect_body(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L4940
 
     objspace->profile.count++;
     objspace->profile.latest_gc_info = reason;
+
     gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_START, 0 /* TODO: pass minor/immediate flag? */);
 
     objspace->profile.total_allocated_object_num_at_gc_start = objspace->profile.total_allocated_object_num;
@@ -4948,7 +4949,9 @@ garbage_collect_body(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L4949
     gc_prof_setup_new_record(objspace, reason);
     gc_prof_timer_start(objspace);
     {
-	assert(during_gc > 0);
+	if (during_gc == 0) {
+	    rb_bug("during_gc should not be 0. RUBY_INTERNAL_EVENT_GC_START user should not cause GC in events.");
+	}
 	gc_marks(objspace, full_mark);
 	gc_sweep(objspace, immediate_sweep);
 	during_gc = 0;

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

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