diff options
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 |