From: "Iñaki Baz Castillo" Date: 2011-12-02T06:01:02+09:00 Subject: Re: GC.malloc_allocated_size and GC.malloc_allocations not available (#if CALC_EXACT_MALLOC_SIZE) 2011/12/1 Eric Wong : > Iñaki Baz Castillo 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. Thanks for the explanation, good to know. BTW I will enable it to test my Ruby C extensions :) -- Iñaki Baz Castillo