patchGNU 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: 

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.

Benno Schulenberg <bens>
Group administrator
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.).

Note that it's on top of patch 9270, and it will only work properly when applied on top of patch 9270 (or something equivalent), since display_string() needs to stop after going over span columns for this to not write past the end of converted.

David Lawrence Ramsey <dolorous>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by dolorous (Submitted the item)
  •  

    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/ClosedOpen Closed
    2017-02-28 bens Priority5 - Normal 3 - Low
        StatusNone Wont Do
    2017-02-25 dolorous Attached File- Added 0001-tweaks-only-allocate-space-for-what-s-displayed.patch, #39832

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code