summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-12-17 09:18:54 -0500
committerPeter Zhu <peter@peterzhu.ca>2022-12-17 09:18:54 -0500
commit6e3bc6710324aeb75299c9edce305b6f7c22321c (patch)
tree8feb594efd2c2728e8b2d620d78f256ee5e74cde /gc.c
parent965f4259db5ad59045f778d4129f65e381aab004 (diff)
Hard crash when allocating in GC when RUBY_DEBUG
Not all builds have RGENGC_CHECK_MODE set, so it should also crash when RUBY_DEBUG is set.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index c9d336eed3..3f6a1bde51 100644
--- a/gc.c
+++ b/gc.c
@@ -12280,7 +12280,7 @@ objspace_xmalloc0(rb_objspace_t *objspace, size_t size)
{
if (UNLIKELY(malloc_during_gc_p(objspace))) {
rb_warn("malloc during GC detected, this could cause crashes if it triggers another GC");
-#if RGENGC_CHECK_MODE
+#if RGENGC_CHECK_MODE || RUBY_DEBUG
rb_bug("Cannot malloc during GC");
#endif
}
@@ -12304,7 +12304,7 @@ objspace_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t ol
{
if (UNLIKELY(malloc_during_gc_p(objspace))) {
rb_warn("realloc during GC detected, this could cause crashes if it triggers another GC");
-#if RGENGC_CHECK_MODE
+#if RGENGC_CHECK_MODE || RUBY_DEBUG
rb_bug("Cannot realloc during GC");
#endif
}
@@ -12548,7 +12548,7 @@ objspace_xcalloc(rb_objspace_t *objspace, size_t size)
{
if (UNLIKELY(malloc_during_gc_p(objspace))) {
rb_warn("calloc during GC detected, this could cause crashes if it triggers another GC");
-#if RGENGC_CHECK_MODE
+#if RGENGC_CHECK_MODE || RUBY_DEBUG
rb_bug("Cannot calloc during GC");
#endif
}