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

ruby-changes:31342

From: ko1 <ko1@a...>
Date: Sat, 26 Oct 2013 04:09:22 +0900 (JST)
Subject: [ruby-changes:31342] ko1:r43421 (trunk): * gc.c (gc_before_heap_sweep): fix freelist management.

ko1	2013-10-26 04:09:14 +0900 (Sat, 26 Oct 2013)

  New Revision: 43421

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

  Log:
    * gc.c (gc_before_heap_sweep): fix freelist management.
      After rb_gc_force_recycle() for a object blonging to heap->freelist,
      `heap->using_page->freelist' is not null.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43420)
+++ ChangeLog	(revision 43421)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 26 04:01:35 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_before_heap_sweep): fix freelist management.
+	  After rb_gc_force_recycle() for a object blonging to heap->freelist,
+	  `heap->using_page->freelist' is not null.
+
 Thu Oct 24 21:57:24 2013  Marc-Andre Lafortune  <ruby-core@m...>
 
 	* parse.y: Remove +(binary) and -(binary) special cases
Index: gc.c
===================================================================
--- gc.c	(revision 43420)
+++ gc.c	(revision 43421)
@@ -2483,7 +2483,18 @@ gc_before_heap_sweep(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L2483
     heap->free_pages = NULL;
 
     if (heap->using_page) {
-	heap->using_page->freelist = heap->freelist;
+	if (heap->using_page->freelist) {
+	    RVALUE *pstart = heap->using_page->freelist;
+	    RVALUE *p = heap->using_page->freelist;
+	    while (p->as.free.next) {
+		p = p->as.free.next;
+	    }
+	    p->as.free.next = heap->freelist;
+	    heap->using_page->freelist = pstart;
+	}
+	else {
+	    heap->using_page->freelist = heap->freelist;
+	}
 	heap->using_page = NULL;
     }
     heap->freelist = NULL;

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

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