diff --git a/R3.xs b/R3.xs index 244517c..6ad3cfd 100644 --- a/R3.xs +++ b/R3.xs @@ -674,4 +674,10 @@ static void (*zmalloc_oom_handler)(size_t) = zmalloc_default_oom; void *zmalloc(size_t size) { void *ptr = malloc(size+PREFIX_SIZE); - if (!ptr) zmalloc_oom_handler(s \ No newline at end of file + if (!ptr) zmalloc_oom_handler(size); +#ifdef HAVE_MALLOC_SIZE + update_zmalloc_stat_alloc(zmalloc_size(ptr)); + return ptr; +#else + *((size_t*)ptr) = size; + \ No newline at end of file