Permalink
Browse files

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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 1cb08e9 commit a223ff83b07061fe6b7259a72041c4adcc87421b @nagachika nagachika committed Aug 30, 2014
Showing with 25 additions and 7 deletions.
  1. +12 −0 ChangeLog
  2. +12 −6 gc.c
  3. +1 −1 version.h
View
@@ -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>
* ext/win32ole/win32ole.c (ole_create_dcom): use the converted
View
@@ -519,6 +519,9 @@ typedef struct rb_objspace {
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)
(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
}
View
@@ -1,6 +1,6 @@
#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

0 comments on commit a223ff8

Please sign in to comment.