ruby-changes:35244
From: nagachika <ko1@a...>
Date: Sun, 31 Aug 2014 01:29:50 +0900 (JST)
Subject: [ruby-changes:35244] nagachika:r47326 (ruby_2_1): merge revision(s) r46387: [Backport #9607]
nagachika 2014-08-31 01:29:40 +0900 (Sun, 31 Aug 2014) New Revision: 47326 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47326 Log: merge revision(s) r46387: [Backport #9607] * gc.c: change full GC timing to keep lower memory usage. Extend heap only at (1) after major GC or (2) after several (two times, at current) minor GC Details in https://bugs.ruby-lang.org/issues/9607#note-9 [Bug #9607] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/gc.c branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 47325) +++ ruby_2_1/ChangeLog (revision 47326) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Sun Aug 31 01:13:21 2014 Koichi Sasada <ko1@a...> + + * gc.c: change full GC timing to keep lower memory usage. + + Extend heap only at + (1) after major GC + or + (2) after several (two times, at current) minor GC + + Details in https://bugs.ruby-lang.org/issues/9607#note-9 + [Bug #9607] + Sun Aug 31 01:07:05 2014 Masaki Suketa <masaki.suketa@n...> * ext/win32ole/win32ole.c (ole_create_dcom): use the converted Index: ruby_2_1/gc.c =================================================================== --- ruby_2_1/gc.c (revision 47325) +++ ruby_2_1/gc.c (revision 47326) @@ -519,6 +519,9 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/ruby_2_1/gc.c#L519 int parent_object_is_old; int need_major_gc; + + size_t last_major_gc; + size_t remembered_shady_object_count; size_t remembered_shady_object_limit; size_t old_object_count; @@ -2954,14 +2957,17 @@ gc_after_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/gc.c#L2957 (int)heap->total_slots, (int)heap_pages_swept_slots, (int)heap_pages_min_free_slots); if (heap_pages_swept_slots < heap_pages_min_free_slots) { - heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT); - heap_increment(objspace, heap); - #if USE_RGENGC - if (objspace->rgengc.remembered_shady_object_count + objspace->rgengc.old_object_count > (heap_pages_length * HEAP_OBJ_LIMIT) / 2) { - /* if [old]+[remembered shady] > [all object count]/2, then do major GC */ - objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_RESCAN; + if (objspace->rgengc.during_minor_gc && objspace->profile.count - objspace->rgengc.last_major_gc > 2 /* magic number */) { + objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_NOFREE; } + else { + heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT); + heap_increment(objspace, heap); + } +#else + heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT); + heap_increment(objspace, heap); #endif } Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 47325) +++ ruby_2_1/version.h (revision 47326) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-08-31" -#define RUBY_PATCHLEVEL 215 +#define RUBY_PATCHLEVEL 216 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 8 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46387 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/