[RFC] how to get the size of a malloc(9) block ?
John-Mark Gurney
jmg at funkthat.com
Sun Dec 1 02:20:06 UTC 2013
Luigi Rizzo wrote this message on Fri, Nov 29, 2013 at 17:11 -0800:
> On Fri, Nov 29, 2013 at 4:49 PM, Adrian Chadd <adrian at freebsd.org> wrote:
>
> > The reason I wouldn't implement this is to avoid having code that
> > _relies_ on this behaviour in order to function or perform well.
>
>
> nobody ever said (or could reasonably expect to do) that.
>
> Applications don't know if the allocator overallocates,
> so they have no hope unless they work even without the feature.
>
> This is only about giving them an option to improve
> performance in those (rare ?) cases where, as i showed,
> knowing the underlying allocation size may lead to
> better usage of memory.
This sounds like optimizing before measuring if your putting in code
like that...
Either it happens rarely, and always doing a realloc won't hurt
performance, or it happens often, and then you should be using a larger
buffer in the first place..
Do I need to quote the optimization rules?
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-current
mailing list