summaryrefslogtreecommitdiff
path: root/src/malloc/malloc_usable_size.c
AgeCommit message (Collapse)AuthorLines
2020-06-03move oldmalloc to its own directory under src/mallocRich Felker-9/+0
this sets the stage for replacement, and makes it practical to keep oldmalloc around as a build option for a while if that ends up being useful. only the files which are actually part of the implementation are moved. memalign and posix_memalign are entirely generic. in theory calloc could be pulled out too, but it's useful to have it tied to the implementation so as to optimize out unnecessary memset when implementation details make it possible to know the memory is already clear.
2018-09-12hide dependency-triggering pointer object in malloc_usable_size.cRich Felker-2/+2
2018-09-12rework malloc_usable_size to use malloc_impl.hRich Felker-9/+1
2016-01-31fix malloc_usable_size for NULL inputSzabolcs Nagy-1/+1
the linux man page specifies malloc_usable_size(0) to return 0 and this is the semantics other implementations follow (jemalloc). reported by Alexander Monakov.
2014-08-25add malloc_usable_size function and non-stub malloc.hRich Felker-0/+17
this function is needed for some important practical applications of ABI compatibility, and may be useful for supporting some non-portable software at the source level too. I was hesitant to add a function which imposes any constraints on malloc internals; however, it turns out that any malloc implementation which has realloc must already have an efficient way to determine the size of existing allocations, so no additional constraint is imposed. for now, some internal malloc definitions are duplicated in the new source file. if/when malloc is refactored to put them in a shared internal header file, these could be removed. since malloc_usable_size is conventionally declared in malloc.h, the empty stub version of this file was no longer suitable. it's updated to provide the standard allocator functions, nonstandard ones (even if stdlib.h would not expose them based on the feature test macros in effect), and any malloc-extension functions provided (currently, only malloc_usable_size).