summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-05-28 10:31:14 +0900
committerNobuyoshi Nakada <[email protected]>2024-06-02 09:39:20 +0900
commita7d0a910096fd61bff99efdfd6e4810c0287b61e (patch)
tree8908837b83471a7e0b77e36e2c57b7b10f469b5c
parentfc495951b128a4256ba28be560584d2a58530f21 (diff)
Raise memerror when really memory exhausted
Fix segfault when `RUBY_THREAD_VM_STACK_SIZE` environment variable is very large.
-rw-r--r--gc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 474454e487..f47f20fa57 100644
--- a/gc.c
+++ b/gc.c
@@ -2840,14 +2840,16 @@ newobj_alloc(rb_objspace_t *objspace, rb_ractor_newobj_cache_t *cache, size_t si
// Retry allocation after moving to new page
obj = ractor_cache_allocate_slot(objspace, cache, size_pool_idx);
-
- GC_ASSERT(obj != Qfalse);
}
}
if (unlock_vm) {
RB_VM_LOCK_LEAVE_CR_LEV(GET_RACTOR(), &lev);
}
+
+ if (UNLIKELY(obj == Qfalse)) {
+ rb_memerror();
+ }
}
size_pool->total_allocated_objects++;