summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-09-05 10:25:59 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-09-06 08:43:14 -0400
commit6778d2c582d8f17b81b9a8894bd3b2c152050bd3 (patch)
tree71e072024ba81708290a885fb848d8ef52ced56d /gc.c
parent6408da70b036de1d0f158f29051eadf4040ab471 (diff)
Support freeing the lowest memory address page
This should help fix the following flaky test: ``` 1) Failure: TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2751]: <0> expected but was <1>. ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8369
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index cf53cf5270..c8f570940c 100644
--- a/gc.c
+++ b/gc.c
@@ -2058,7 +2058,7 @@ heap_pages_free_unused_pages(rb_objspace_t *objspace)
}
if (has_pages_in_tomb_heap) {
- for (i = j = 1; j < heap_allocated_pages; i++) {
+ for (i = j = 0; j < heap_allocated_pages; i++) {
struct heap_page *page = heap_pages_sorted[i];
if (page->flags.in_tomb && page->free_slots == page->total_slots) {
@@ -2078,6 +2078,11 @@ heap_pages_free_unused_pages(rb_objspace_t *objspace)
GC_ASSERT(himem <= heap_pages_himem);
heap_pages_himem = himem;
+ struct heap_page *lopage = heap_pages_sorted[0];
+ uintptr_t lomem = (uintptr_t)lopage->start;
+ GC_ASSERT(lomem >= heap_pages_lomem);
+ heap_pages_lomem = lomem;
+
GC_ASSERT(j == heap_allocated_pages);
}
}