Skip to content

Commit 6aa8309

Browse files
committed
Get rid of weighted average for heap_allocatable_bytes_expand
gcbench on ruby-bench was faring much worse with this enabled. I believe it increases heap size too much in some cases. Remove for now and re-investigate later.
1 parent d414072 commit 6aa8309

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

gc/default/default.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7126,13 +7126,13 @@ gc_marks_finish(rb_objspace_t *objspace)
71267126

71277127
if (full_marking) {
71287128
/* Use weighted average slot size since total_slots spans all heaps */
7129-
size_t total_heap_bytes = 0;
7130-
for (int i = 0; i < HEAP_COUNT; i++) {
7131-
total_heap_bytes += heaps[i].total_slots * heaps[i].slot_size;
7132-
}
7133-
size_t avg_slot_size = total_slots > 0 ? total_heap_bytes / total_slots : (size_t)heaps[0].slot_size;
7134-
heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, avg_slot_size);
7135-
//heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, heaps[0].slot_size);
7129+
/*size_t total_heap_bytes = 0;*/
7130+
/*for (int i = 0; i < HEAP_COUNT; i++) {*/
7131+
/*total_heap_bytes += heaps[i].total_slots * heaps[i].slot_size;*/
7132+
/*}*/
7133+
/*size_t avg_slot_size = total_slots > 0 ? total_heap_bytes / total_slots : (size_t)heaps[0].slot_size;*/
7134+
/*heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, avg_slot_size);*/
7135+
heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, heaps[0].slot_size);
71367136
}
71377137
}
71387138

0 commit comments

Comments
 (0)