Skip to content

Commit 8bacf20

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 2c6c017 commit 8bacf20

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
@@ -7175,13 +7175,13 @@ gc_marks_finish(rb_objspace_t *objspace)
71757175

71767176
if (full_marking) {
71777177
/* Use weighted average slot size since total_slots spans all heaps */
7178-
size_t total_heap_bytes = 0;
7179-
for (int i = 0; i < HEAP_COUNT; i++) {
7180-
total_heap_bytes += heaps[i].total_slots * heaps[i].slot_size;
7181-
}
7182-
size_t avg_slot_size = total_slots > 0 ? total_heap_bytes / total_slots : (size_t)heaps[0].slot_size;
7183-
heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, avg_slot_size);
7184-
//heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, heaps[0].slot_size);
7178+
/*size_t total_heap_bytes = 0;*/
7179+
/*for (int i = 0; i < HEAP_COUNT; i++) {*/
7180+
/*total_heap_bytes += heaps[i].total_slots * heaps[i].slot_size;*/
7181+
/*}*/
7182+
/*size_t avg_slot_size = total_slots > 0 ? total_heap_bytes / total_slots : (size_t)heaps[0].slot_size;*/
7183+
/*heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, avg_slot_size);*/
7184+
heap_allocatable_bytes_expand(objspace, NULL, sweep_slots, total_slots, heaps[0].slot_size);
71857185
}
71867186
}
71877187

0 commit comments

Comments
 (0)