Iaki Baz Castillo <ibc / aliax.net> wrote:
> So it seems that in my system CALC_EXACT_MALLOC_SIZE is not set since
> gc.c file also contains:
> 
> #define CALC_EXACT_MALLOC_SIZE 0
> 
> Why is it unavailable?

Enabling that breaks any C extensions that (incorrectly) mix
x{m,c,re}alloc() calls with regular free() and vice-versa.

Even worse, this breakage isn't noticeable at build/compile time,
so it's not easy to find/fix everywhere, especially if it's not
in regular code paths.

Maybe Ruby should have a alternative *alloc API that enforce this:
(rb_emalloc, rb_ecalloc, rb_erealloc, rb_efree) and we can deprecate
the x* one slowly without breaking existing extensions.