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
Unknown Object (File)
Sun, Aug 30, 5:38 AM
Unknown Object (File)
Fri, Aug 28, 4:51 PM
Unknown Object (File)
Fri, Aug 28, 4:51 PM
Unknown Object (File)
Wed, Aug 26, 12:56 PM
Unknown Object (File)
Thu, Aug 13, 1:25 AM
Unknown Object (File)
Thu, Aug 13, 12:44 AM
Unknown Object (File)
Mon, Aug 10, 7:26 AM
Unknown Object (File)
Mon, Aug 10, 6:47 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 73565
Build 70448: arc lint + arc unit