question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reuse the empty character structure to save memory and processing time

See original GitHub issue

Right now on resize the line is filled with “empty” characters which pad the row, these are then cut from the row if the resize reduces columns.

A better way to handle this would be to have a single “padding” char which is not added to the rows but instead used to fill in the rows if a row’s size is less than Terminal.cols.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyriarcommented, Jan 18, 2017

Would have to test it but the idea would be to always assume rows are this.cols in length and if it’s not found, assume it’s the empty character. If you have a good test case for your concern let me know.

1reaction
Tyriarcommented, Jan 13, 2017

I think the structure should stay the same, just not create so many nbsp character arrays.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory allocation for char array - Stack Overflow
I want to create an array of chars and I don't know yet what size it will be. I want to write something...
Read more >
Dynamic Memory Allocation and Fragmentation in C and C++
In C, dynamic memory is allocated from the heap using some standard library functions. The two key dynamic memory functions are malloc() and...
Read more >
C++ Tutorial: Memory Allocation - 2020 - BogoToBogo
A variable is deallocated when the system reclaims the memory from the variable, so it no longer has an area to store its...
Read more >
4. Optimize String Use: A Case Study - Optimized C++ [Book]
If the string variable referenced by result is empty, then the call to reserve() allocates storage for enough characters. If the string variable...
Read more >
Archived | Building your own memory manager for C/C++ ...
This tutorial demystifies memory management concepts by telling you how to create your ... Modified data structure to store Complex* with no extra...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found