GNU nano - Patches: patch #9271, cut down on memory usage in...
You are not allowed to post comments on this tracker with your current authentication level.
patch #9271: cut down on memory usage in display_string()
Submitter: | David Lawrence Ramsey <dolorous> | ||
Submitted: | Sat 25 Feb 2017 07:49:01 PM UTC | ||
Priority: | 3 - Low | Status: | Wont Do |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Closed | Release: | None |
Tue 28 Feb 2017 04:34:22 PM UTC, comment #1: |
Benno Schulenberg <bens> |
Sat 25 Feb 2017 07:49:01 PM UTC, original submission:
The attached patch against current git makes display_string() only allocate the space needed for span columns of text (plus the usual extra padding for multibyte characters, tabs, etc.).
|
David Lawrence Ramsey <dolorous> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2017-04-02 | bens | Open/Closed | Open | Closed | |
2017-02-28 | bens | Priority | 5 - Normal | 3 - Low | |
Status | None | Wont Do | |||
2017-02-25 | dolorous | Attached File | - | Added 0001-tweaks-only-allocate-space-for-what-s-displayed.patch, #39832 |
Powered by Savane 3.13-02a9.
Corresponding source code
Running actual_x() is a relatively costly operation. Spending extra cycles to possibly reduce the amount of memory allocated... I don't think that is a good idea.
(Also, instead of using an extra variable and doing 'strnlen(buf, last_column_index)...', it would have been enough to simply do 'actual_x(buf, span)...'.)
What would be nice: to allocate a buffer that is large enough to render any string that will fit within COLS columns, just once. Allocate it at startup, and reallocate it when the screen resizes. That would save at least 25 mallocs and frees for every screen refresh. But that is hard to compute when taking combining characters into account... I don't know how many of them can be stacked.