summaryrefslogtreecommitdiff
path: root/include/ruby/io/buffer.h
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2025-04-03 16:43:09 -0400
committerPeter Zhu <peter@peterzhu.ca>2025-04-07 09:41:11 -0400
commitd4406f0627c78af31e61f9e07dda9151e109dbc4 (patch)
tree4010a3107ca701b4b69e808f7a8736073498c0e7 /include/ruby/io/buffer.h
parent432e5fa7e4ad57e0d8dcfcec29f0426aac7aedb4 (diff)
Grow GC heaps independently
[Bug #21214] If we allocate objects where one heap holds transient objects and another holds long lived objects, then the heap with transient objects will grow along the heap with long lived objects, causing higher memory usage. For example, we can see this issue in this script: def allocate_small_object = [] def allocate_large_object = Array.new(10) arys = Array.new(1_000_000) do # Allocate 10 small transient objects 10.times { allocate_small_object } # Allocate 1 large object that is persistent allocate_large_object end pp GC.stat pp GC.stat_heap Before this change: heap_live_slots: 2837243 {0 => {slot_size: 40, heap_eden_pages: 1123, heap_eden_slots: 1838807}, 2 => {slot_size: 160, heap_eden_pages: 2449, heap_eden_slots: 1001149}, } After this change: heap_live_slots: 1094474 {0 => {slot_size: 40, heap_eden_pages: 58, heap_eden_slots: 94973}, 2 => {slot_size: 160, heap_eden_pages: 2449, heap_eden_slots: 1001149}, }
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13061
Diffstat (limited to 'include/ruby/io/buffer.h')
0 files changed, 0 insertions, 0 deletions