malloc: implement malloc_usable_size().

* Fix #12132
This commit is contained in:
Jérôme Duval 2015-06-13 14:25:35 +02:00
parent 673259506b
commit 0dc6b011fe
2 changed files with 13 additions and 0 deletions

View File

@ -20,6 +20,10 @@ extern void free(void *pointer);
extern void *memalign(size_t alignment, size_t numBytes);
extern void *valloc(size_t numBytes);
#ifdef _GNU_SOURCE
size_t malloc_usable_size(void *ptr);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -490,6 +490,15 @@ realloc(void *ptr, size_t size)
}
extern "C" size_t
malloc_usable_size(void *ptr)
{
if (ptr == NULL)
return 0;
return threadHeap::objectSize(ptr);
}
// #pragma mark - BeOS specific extensions