[RFC] how to get the size of a malloc(9) block ?

jb jb.1234abcd at gmail.com
Sun Dec 1 16:12:26 UTC 2013


Daniel Nebdal <dnebdal <at> gmail.com> writes:

> ...
> That could alternatively be solved by having an "if I ask for N bytes right
> now, how large would the block be" - API that doesn't promise too much.
> Call it something like "malloc_suggest_size(size_t minsize) ", and make the
> description something like ...  "return the largest number of bytes that
> would not allocate a larger block of memory than the provided minsize, in
> the current memory situation", plus some veiled threats about not using
> this value to do anything fancy with pointers to already-allocated memory.

Yeap. It is like asking teenagers to be abstinent ...
http://www.youtube.com/watch?v=SWlbN2b1PGg

Good luck !
jb
 





More information about the freebsd-current mailing list