diff --git a/include/leak_detector.h b/include/leak_detector.h index f8161b27e..c85502c44 100644 --- a/include/leak_detector.h +++ b/include/leak_detector.h @@ -57,6 +57,9 @@ #undef posix_memalign #define posix_memalign(p,a,n) GC_posix_memalign(p,a,n) +#undef malloc_usable_size +#define malloc_usable_size(p) GC_size(p) + #ifndef CHECK_LEAKS # define CHECK_LEAKS() GC_gcollect() /* Note 1: CHECK_LEAKS does not have GC prefix (preserved for */ diff --git a/tests/leak_test.c b/tests/leak_test.c index 37fa26b3f..f13d08138 100644 --- a/tests/leak_test.c +++ b/tests/leak_test.c @@ -23,6 +23,7 @@ int main(void) { for (i = 0; i < 10; ++i) { p[i] = (char*)malloc(sizeof(int)+i); CHECK_OUT_OF_MEMORY(p[i]); + (void)malloc_usable_size(p[i]); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) {