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

From: John-Mark Gurney <jmg_at_funkthat.com>
Date: Sat, 30 Nov 2013 18:20:03 -0800
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."
Received on Sun Dec 01 2013 - 01:20:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:44 UTC