summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <[email protected]>2024-01-11 16:05:21 -0800
committerAaron Patterson <[email protected]>2024-01-12 09:31:36 -0800
commit8b8dcc7af174def5216044019c1d3e42edfdc7cf ()
tree68d84a5ddd99991ecd349eabc193036f9b68888c
parent2d9db72d37e570dcfc5e8b0b74476360cae96056 (diff)
Handle mmap failures for redblack tree cache
The redblack tree cache is totally optional, so if we can't allocate room for the cache, then just pretend as if the cache is full if mmap fails
-rw-r--r--shape.c8
1 files changed, 8 insertions, 0 deletions
@@ -1233,6 +1233,14 @@ Init_default_shapes(void)
rb_shape_tree_ptr->shape_cache = (redblack_node_t *)mmap(NULL, rb_size_mul_or_raise(REDBLACK_CACHE_SIZE, sizeof(redblack_node_t), rb_eRuntimeError),
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
rb_shape_tree_ptr->cache_size = 0;
#endif
// Shapes by size pool