Date: Sat, 30 Nov 2013 18:20:03 -0800 From: John-Mark Gurney <jmg@funkthat.com> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: Adrian Chadd <adrian@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>, jb <jb.1234abcd@gmail.com> Subject: Re: [RFC] how to get the size of a malloc(9) block ? Message-ID: <20131201022002.GE55638@funkthat.com> In-Reply-To: <CA%2BhQ2%2Bi7woEM9x7Ymo%2BD4FbG2rn0eRYnX=7mUTrPjDqj-pme7A@mail.gmail.com> References: <CA%2BhQ2%2BgK1pc_aS1LEKp29Bi=MHFtJCkw2uOrib_9wQ-7AziH=w@mail.gmail.com> <loom.20131130T002152-608@post.gmane.org> <CA%2BhQ2%2Bj0cYW0dfhEtMGRXWhXhS=VF_N_ZB=JmcqRUofFKWXFiQ@mail.gmail.com> <CAJ-Vmon2dy94jCUwrBjObrxahmaTyqYZJZo4Lren2Km_vX3_OA@mail.gmail.com> <CA%2BhQ2%2Bi7woEM9x7Ymo%2BD4FbG2rn0eRYnX=7mUTrPjDqj-pme7A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131201022002.GE55638>