summaryrefslogtreecommitdiff
path: root/transient_heap.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-11-01 14:33:44 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-11-01 16:58:19 +0900
commitfb495b2928545e44cc9859f7cc743032d92ca9ee (patch)
treec8754f20eaa1a35653395bead3c70c9e6ed70dcf /transient_heap.c
parent2c889e9b05e2d2902096af02687cc6e3c7424c30 (diff)
downloadruby-fb495b2928545e44cc9859f7cc743032d92ca9ee.tar.gz
rb_aligned_malloc can return NULL
Looking at gc.c, rb_aligned_malloc contains `return NULL;` so it has to be taken care of. Note however that posix_memalign(3posix) does _not_ set errno.
Diffstat (limited to 'transient_heap.c')
-rw-r--r--transient_heap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/transient_heap.c b/transient_heap.c
index 6cdd34284f..6e9cf6440e 100644
--- a/transient_heap.c
+++ b/transient_heap.c
@@ -294,6 +294,9 @@ transient_heap_block_alloc(struct transient_heap* theap)
#else
if (theap->arena == NULL) {
theap->arena = rb_aligned_malloc(TRANSIENT_HEAP_BLOCK_SIZE, TRANSIENT_HEAP_TOTAL_SIZE);
+ if (theap->arena == NULL) {
+ rb_bug("transient_heap_block_alloc: failed\n");
+ }
}
TH_ASSERT(theap->arena_index < TRANSIENT_HEAP_BLOCK_NUM);