debug heap: implement malloc_usable_size
Change-Id: I49d7918df00cca4b889f6a3cf52c3f903ee5fa2a Reviewed-on: https://review.haiku-os.org/c/haiku/+/2179 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
fdc13d7d97
commit
c529e2a354
@ -302,3 +302,21 @@ posix_memalign(void **pointer, size_t alignment, size_t size)
|
|||||||
|
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user