diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-05-28 10:31:14 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-06-02 09:39:20 +0900 |
commit | a7d0a910096fd61bff99efdfd6e4810c0287b61e (patch) | |
tree | 8908837b83471a7e0b77e36e2c57b7b10f469b5c | |
parent | fc495951b128a4256ba28be560584d2a58530f21 (diff) |
Raise memerror when really memory exhausted
Fix segfault when `RUBY_THREAD_VM_STACK_SIZE` environment variable is
very large.
-rw-r--r-- | gc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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++; |