NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/60995: libedit: allocate display rows on demand



Attached an updated patch that handles allocation failures. I had to add 14 checks of the new error flag in various places. Let me know what you think.

Alternatively, we could use the previous patch with exit() but provide an API or CONFIG_DELAYED_DISPLAY_ALLOC option to enable the delayed allocation so it is only an opt-in behavior.

On Thu, Nov 12, 2026 at 2:15 PM Christos Zoulas via gnats <gnats-admin%netbsd.org@localhost> wrote:
The following reply was made to PR lib/60995; it has been noted by GNATS.

From: Christos Zoulas <christos%zoulas.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lib-bug-people%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost,
 hzhong%gmail.com@localhost
Subject: Re: lib/60995: libedit: allocate display rows on demand
Date: Thu, 12 Nov 2026 17:09:54 -0500

 >=20
 > If you think this is a good idea, I can spend more time working out a
 > solution, which will undoubtedly add more complexity. Honestly the
 > application is already cooked if they cannot allocate more memory at =
 this
 > point, and often it's easier to restart it then to keep running. But =
 if
 > that's what it takes to optimize the memory usage I can do it. The =
 memory
 > savings can be huge.
 >=20

 Yes, but it is not up to the library to abort or exit if it can't =
 allocate memory,
 specially one that might not be the primary function of the application =
 like
 command line editing. The application might have already allocated all
 the memory it needs to operate and just the editor part might be
 non-functional.  The library does not abort() or exit() anywhere else
 now, (there are abort() calls from programming errors, not transient =
 ones).

 christos=

Attachment: netbsd-libedit-lazy-buffer-allocation-v2.patch
Description: Binary data



Home | Main Index | Thread Index | Old Index