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>.
```
This commit is contained in:
Peter Zhu 2023-09-05 10:25:59 -04:00
Родитель 6408da70b0
Коммит 6778d2c582
1 изменённых файлов: 6 добавлений и 1 удалений

7
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);
}
}