Skip to content

Commit a223ff8

Browse files
committed
merge revision(s) r46387: [Backport ruby#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 ruby#9607] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 1cb08e9 commit a223ff8

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Sun Aug 31 01:13:21 2014 Koichi Sasada <[email protected]>
2+
3+
* gc.c: change full GC timing to keep lower memory usage.
4+
5+
Extend heap only at
6+
(1) after major GC
7+
or
8+
(2) after several (two times, at current) minor GC
9+
10+
Details in https://bugs.ruby-lang.org/issues/9607#note-9
11+
[Bug #9607]
12+
113
Sun Aug 31 01:07:05 2014 Masaki Suketa <[email protected]>
214

315
* ext/win32ole/win32ole.c (ole_create_dcom): use the converted

gc.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ typedef struct rb_objspace {
519519
int parent_object_is_old;
520520

521521
int need_major_gc;
522+
523+
size_t last_major_gc;
524+
522525
size_t remembered_shady_object_count;
523526
size_t remembered_shady_object_limit;
524527
size_t old_object_count;
@@ -2954,14 +2957,17 @@ gc_after_sweep(rb_objspace_t *objspace)
29542957
(int)heap->total_slots, (int)heap_pages_swept_slots, (int)heap_pages_min_free_slots);
29552958

29562959
if (heap_pages_swept_slots < heap_pages_min_free_slots) {
2957-
heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT);
2958-
heap_increment(objspace, heap);
2959-
29602960
#if USE_RGENGC
2961-
if (objspace->rgengc.remembered_shady_object_count + objspace->rgengc.old_object_count > (heap_pages_length * HEAP_OBJ_LIMIT) / 2) {
2962-
/* if [old]+[remembered shady] > [all object count]/2, then do major GC */
2963-
objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_RESCAN;
2961+
if (objspace->rgengc.during_minor_gc && objspace->profile.count - objspace->rgengc.last_major_gc > 2 /* magic number */) {
2962+
objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_NOFREE;
29642963
}
2964+
else {
2965+
heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT);
2966+
heap_increment(objspace, heap);
2967+
}
2968+
#else
2969+
heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_slots) / HEAP_OBJ_LIMIT);
2970+
heap_increment(objspace, heap);
29652971
#endif
29662972
}
29672973

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-08-31"
3-
#define RUBY_PATCHLEVEL 215
3+
#define RUBY_PATCHLEVEL 216
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 8

0 commit comments

Comments
 (0)