|
|
Log in / Subscribe / Register

Printbuf rebuffed for now

Printbuf rebuffed for now

Posted Apr 29, 2022 7:34 UTC (Fri) by taladar (subscriber, #68407)
In reply to: Printbuf rebuffed for now by nevets
Parent article: Printbuf rebuffed for now

On the other hand statically guessing a required size will probably end up wasting more memory in the vast majority of the cases that do not use the peak amount of memory used in that code-path for all the code-paths where the length of the message varies significantly.


to post comments

Printbuf rebuffed for now

Posted Apr 29, 2022 13:35 UTC (Fri) by ldearquer (guest, #137451) [Link] (1 responses)

Maybe it is not too bad if you constraint your guess to the OOM management code paths. The rest of the code can still allocate dynamically.

Printbuf rebuffed for now

Posted May 5, 2022 10:58 UTC (Thu) by smoogen (subscriber, #97) [Link]

Is it possible to have an 'early' set aside amount of memory, and then try to allocate more if needed and if it fails send a 'truncated' set of the output in the set-aside memory? That way if you run out you can still print something as a fall back? [And from this the try_alloc() call was written.. where we try to allocate but if its not there, meh.]


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds