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

ruby-changes:37393

From: tmm1 <ko1@a...>
Date: Tue, 3 Feb 2015 05:58:46 +0900 (JST)
Subject: [ruby-changes:37393] tmm1:r49474 (trunk): gc.c: ensure GC state is consistent during VM shutdown

tmm1	2015-02-03 05:58:32 +0900 (Tue, 03 Feb 2015)

  New Revision: 49474

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

  Log:
    gc.c: ensure GC state is consistent during VM shutdown
    
    * gc.c (rb_objspace_free): cause rb_bug if lazy sweep is in progress
      during rb_objspace_free. Adds extra protection for r46340.
      Patch by Vicent Marti. [Bug #10768] [ruby-core:67734]
    * gc.c (rb_objspace_call_finalizer): Ensure GC is completed after
      finalizers have run. We already call gc_rest() before invoking
      finalizers, but finalizer can allocate new objects and start new GC
      cycle, so we call gc_rest() again after finalizers are complete.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49473)
+++ ChangeLog	(revision 49474)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb  3 05:52:00 2015  Aman Gupta <ruby@t...>
+
+	* gc.c (rb_objspace_free): cause rb_bug if lazy sweep is in progress
+	  during rb_objspace_free. Adds extra protection for r46340.
+	  Patch by Vicent Marti. [Bug #10768] [ruby-core:67734]
+	* gc.c (rb_objspace_call_finalizer): Ensure GC is completed after
+	  finalizers have run. We already call gc_rest() before invoking
+	  finalizers, but finalizer can allocate new objects and start new GC
+	  cycle, so we call gc_rest() again after finalizers are complete.
+
 Mon Feb  2 10:51:34 2015  Ari Pollak  <ajp@a...>
 
 	* doc/security.rdoc (Symbols): update about Symbol GC.  Symbols
Index: gc.c
===================================================================
--- gc.c	(revision 49473)
+++ gc.c	(revision 49474)
@@ -1209,6 +1209,9 @@ static void heap_page_free(rb_objspace_t https://github.com/ruby/ruby/blob/trunk/gc.c#L1209
 void
 rb_objspace_free(rb_objspace_t *objspace)
 {
+    if (is_lazy_sweeping(heap_eden))
+	rb_bug("lazy sweeping underway when freeing object space");
+
     if (objspace->profile.records) {
 	free(objspace->profile.records);
 	objspace->profile.records = 0;
@@ -2620,6 +2623,12 @@ rb_objspace_call_finalizer(rb_objspace_t https://github.com/ruby/ruby/blob/trunk/gc.c#L2623
     st_free_table(finalizer_table);
     finalizer_table = 0;
     ATOMIC_SET(finalizing, 0);
+
+    /*
+     * finish any lazy sweeps that may have been started
+     * when finalizing the objects in the heap
+     */
+    gc_rest(objspace);
 }
 
 static inline int

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

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