diff --git a/src/system/libroot/posix/malloc_debug/malloc_debug_api.cpp b/src/system/libroot/posix/malloc_debug/malloc_debug_api.cpp index 4a0f87022a..9f03044188 100644 --- a/src/system/libroot/posix/malloc_debug/malloc_debug_api.cpp +++ b/src/system/libroot/posix/malloc_debug/malloc_debug_api.cpp @@ -302,3 +302,21 @@ posix_memalign(void **pointer, size_t alignment, size_t size) return 0; } + + +extern "C" size_t +malloc_usable_size(void *ptr) +{ + size_t size; + thread_id thread; + + if (ptr == NULL) + return 0; + + status_t res = sCurrentHeap->get_allocation_info(ptr, &size, &thread); + + if (res != B_OK) + return 0; + + return size; +}