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

ruby-changes:33575

From: ko1 <ko1@a...>
Date: Tue, 22 Apr 2014 08:37:27 +0900 (JST)
Subject: [ruby-changes:33575] ko1:r45656 (trunk): * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase

ko1	2014-04-22 08:37:18 +0900 (Tue, 22 Apr 2014)

  New Revision: 45656

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

  Log:
    * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
      when memop type is MEMOP_TYPE_REALLOC.
      GC at realloc is not well maintained.
      We need a time to make it safe.
      [ruby-dev:48117]

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45655)
+++ ChangeLog	(revision 45656)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 22 08:22:33 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
+	  when memop type is MEMOP_TYPE_REALLOC.
+
+	  GC at realloc is not well maintained.
+	  We need a time to make it safe.
+	  [ruby-dev:48117]
+
 Tue Apr 22 06:54:15 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
Index: gc.c
===================================================================
--- gc.c	(revision 45655)
+++ gc.c	(revision 45656)
@@ -6097,20 +6097,20 @@ objspace_malloc_increase(rb_objspace_t * https://github.com/ruby/ruby/blob/trunk/gc.c#L6097
 #endif
     }
 
-    if (type == MEMOP_TYPE_MALLOC || type == MEMOP_TYPE_REALLOC) {
-	int full_mark = gc_stress_full_mark_after_malloc_p();
-	if (ruby_gc_stress && !ruby_disable_gc_stress && ruby_native_thread_p()) {
-	    garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC);
-	}
-	else {
-	  retry:
-	    if (malloc_increase > malloc_limit && ruby_native_thread_p()) {
-		if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
-		    gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */
-		    goto retry;
-		}
-		garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC);
+    if (type != MEMOP_TYPE_FREE &&
+	ruby_gc_stress && !ruby_disable_gc_stress &&
+	ruby_native_thread_p()) {
+	garbage_collect_with_gvl(objspace, gc_stress_full_mark_after_malloc_p(), TRUE, GPR_FLAG_MALLOC);
+    }
+
+    if (type == MEMOP_TYPE_MALLOC) {
+      retry:
+	if (malloc_increase > malloc_limit && ruby_native_thread_p()) {
+	    if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
+		gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */
+		goto retry;
 	    }
+	    garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC);
 	}
     }
 

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

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