ruby-changes:31716
From: ko1 <ko1@a...>
Date: Fri, 22 Nov 2013 16:40:41 +0900 (JST)
Subject: [ruby-changes:31716] ko1:r43795 (trunk): * gc.c (heap_set_increment): accept minumum additional page number.
ko1 2013-11-22 16:40:27 +0900 (Fri, 22 Nov 2013) New Revision: 43795 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43795 Log: * gc.c (heap_set_increment): accept minumum additional page number. * gc.c (gc_after_sweep): allocate pages to allocate at least RUBY_HEAP_MIN_SLOTS. [Bug #9137] Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 43794) +++ ChangeLog (revision 43795) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@a...> + + * gc.c (heap_set_increment): accept minumum additional page number. + + * gc.c (gc_after_sweep): allocate pages to allocate at least + RUBY_HEAP_MIN_SLOTS. + [Bug #9137] + Fri Nov 22 16:19:52 2013 Narihiro Nakamura <authornari@g...> * include/ruby/intern.h (rb_gc_set_params): Deprecate Index: gc.c =================================================================== --- gc.c (revision 43794) +++ gc.c (revision 43795) @@ -1135,7 +1135,7 @@ heap_add_pages(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L1135 } static void -heap_set_increment(rb_objspace_t *objspace) +heap_set_increment(rb_objspace_t *objspace, size_t minimum_limit) { size_t used = heap_pages_used - heap_tomb->used; size_t next_used_limit = (size_t)(used * gc_params.growth_factor); @@ -1144,6 +1144,11 @@ heap_set_increment(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L1144 if (next_used_limit > max_used_limit) next_used_limit = max_used_limit; } if (next_used_limit == heap_pages_used) next_used_limit++; + + if (next_used_limit < minimum_limit) { + next_used_limit = minimum_limit; + } + heap_pages_increment = next_used_limit - used; heap_pages_expand_sorted(objspace); @@ -2750,7 +2755,7 @@ gc_heap_prepare_minimum_pages(rb_objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L2755 { if (!heap->free_pages) { /* there is no free after page_sweep() */ - heap_set_increment(objspace); + heap_set_increment(objspace, 0); if (!heap_increment(objspace, heap)) { /* can't allocate additional free objects */ during_gc = 0; rb_memerror(); @@ -2885,7 +2890,7 @@ gc_after_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L2890 (int)heap->limit, (int)heap_pages_swept_num, (int)heap_pages_min_free_slots); if (heap_pages_swept_num < heap_pages_min_free_slots) { - heap_set_increment(objspace); + heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_num) / HEAP_OBJ_LIMIT); heap_increment(objspace, heap); #if USE_RGENGC @@ -4849,7 +4854,7 @@ heap_ready_to_gc(rb_objspace_t *objspace https://github.com/ruby/ruby/blob/trunk/gc.c#L4854 if (dont_gc || during_gc) { if (!heap->freelist && !heap->free_pages) { if (!heap_increment(objspace, heap)) { - heap_set_increment(objspace); + heap_set_increment(objspace, 0); heap_increment(objspace, heap); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/