On Mon, Dec 13, 2021 at 02:52:50AM -0600, Scott Cheloha wrote:

> > On Dec 13, 2021, at 01:13, Otto Moerbeek <o...@drijf.net> wrote:
> > 
> > On Sun, Dec 12, 2021 at 07:15:51PM -0600, Scott Cheloha wrote:
> > 
> >> cat(1) sizes its I/O buffer according to the st_blksize of the first
> >> file it processes.  We don't do this very often in the tree.  I'm not
> >> sure if we should trust st_blksize.
> >> 
> >> It would be simpler to just choose a value that works in practice and
> >> always use it.
> >> 
> >> 64K works well.  We settled on that for tee(1) recently.
> > 
> > Why are you also change the allocation to be per-file? You might as
> > well go for a static buffer if you make it fixed size.
> 
> Ottomalloc does canary checks when free(3)
> is called if malloc_options is set up for it.
> I always thought that was useful when 
> auditing my code.

In this case (large allocation an exact multiple of the page size) any
overflow will be caught by the MMU, independent of malloc options.  So
no big gain here to be gained from calling free. I'd say keep the
original one time malloc call.

        -Otto

Reply via email to