Skip to content

Commit

Permalink
merge revision(s) r46387: [Backport #9607]
Browse files Browse the repository at this point in the history
	* 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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nagachika committed Aug 30, 2014
1 parent 1cb08e9 commit a223ff8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,15 @@
Sun Aug 31 01:13:21 2014 Koichi Sasada <ko1@atdot.net>

* 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@nifty.ne.jp> Sun Aug 31 01:07:05 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>


* ext/win32ole/win32ole.c (ole_create_dcom): use the converted * ext/win32ole/win32ole.c (ole_create_dcom): use the converted
Expand Down
18 changes: 12 additions & 6 deletions gc.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ typedef struct rb_objspace {
int parent_object_is_old; int parent_object_is_old;


int need_major_gc; int need_major_gc;

size_t last_major_gc;

size_t remembered_shady_object_count; size_t remembered_shady_object_count;
size_t remembered_shady_object_limit; size_t remembered_shady_object_limit;
size_t old_object_count; size_t old_object_count;
Expand Down Expand Up @@ -2954,14 +2957,17 @@ gc_after_sweep(rb_objspace_t *objspace)
(int)heap->total_slots, (int)heap_pages_swept_slots, (int)heap_pages_min_free_slots); (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) { 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 USE_RGENGC
if (objspace->rgengc.remembered_shady_object_count + objspace->rgengc.old_object_count > (heap_pages_length * HEAP_OBJ_LIMIT) / 2) { if (objspace->rgengc.during_minor_gc && objspace->profile.count - objspace->rgengc.last_major_gc > 2 /* magic number */) {
/* if [old]+[remembered shady] > [all object count]/2, then do major GC */ objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_NOFREE;
objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_RESCAN;
} }
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 #endif
} }


Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2" #define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-08-31" #define RUBY_RELEASE_DATE "2014-08-31"
#define RUBY_PATCHLEVEL 215 #define RUBY_PATCHLEVEL 216


#define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8
Expand Down

0 comments on commit a223ff8

Please sign in to comment.