summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index e6a7fcc330..696fb7ab59 100644
--- a/gc.c
+++ b/gc.c
@@ -941,6 +941,24 @@ ruby_xfree(void *x)
}
+/* Mimic ruby_xmalloc, but need not rb_objspace.
+ * should return pointer suitable for ruby_xfree
+ */
+void *
+ruby_mimmalloc(size_t size)
+{
+ void *mem;
+#if CALC_EXACT_MALLOC_SIZE
+ size += sizeof(size_t);
+#endif
+ mem = malloc(size);
+#if CALC_EXACT_MALLOC_SIZE
+ ((size_t *)mem)[0] = size;
+ mem = (size_t *)mem + 1;
+#endif
+ return mem;
+}
+
/*
* call-seq:
* GC.enable -> true or false