Page MenuHomeFreeBSD

stdio: *memstream: decouple the buffer size from the stream length
ClosedPublic

Authored by kevans on May 29 2026, 11:43 PM.
Tags
None
Referenced Files
F166348332: D57354.id178972.diff
Thu, Aug 13, 1:25 AM
F166342792: D57354.id.diff
Thu, Aug 13, 12:44 AM
Unknown Object (File)
Mon, Aug 10, 7:26 AM
Unknown Object (File)
Mon, Aug 10, 6:47 AM
Unknown Object (File)
Sun, Aug 9, 8:46 PM
Unknown Object (File)
Sat, Aug 8, 3:32 PM
Unknown Object (File)
Sat, Aug 8, 5:59 AM
Unknown Object (File)
Sat, Aug 8, 2:27 AM
Subscribers

Details

Summary

It's useful to be able to track both facts with a single variable, but
it also makes it more difficult to change how the buffer size scales.

As an example, Apple's implementation seems to scale the buffer size by
1.5x on growth, presumably in an attempt to reduce trips into realloc().
This might be questionable in the face of stdio buffering, but avoiding
serious churn in the line- or un-buffered case is a net positive if
doing so isn't incredibly invasive.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable