Skip to content

Fix heap blowout on TBeams#10155

Merged
thebentern merged 6 commits into
masterfrom
optimize-message-renderer-heap
Apr 13, 2026
Merged

Fix heap blowout on TBeams#10155
thebentern merged 6 commits into
masterfrom
optimize-message-renderer-heap

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

No description provided.

@thebentern thebentern requested a review from Copilot April 13, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Reduces heap churn in message rendering (notably on TBeams) by preallocating per-line vectors and avoiding string copies during line collection/caching.

Changes:

  • Pre-reserve capacity for line/metadata vectors based on an estimated wrapped-line count.
  • Move wrapped strings into allLines instead of copying.
  • Swap allLines into cachedLines to avoid an additional copy.

Comment thread src/graphics/draw/MessageRenderer.cpp Outdated
Comment thread src/graphics/draw/MessageRenderer.cpp Outdated
@thebentern thebentern requested a review from Copilot April 13, 2026 14:15
@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels Apr 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread src/graphics/draw/MessageRenderer.cpp Outdated
Comment thread src/graphics/draw/MessageRenderer.cpp
Comment thread src/MessageStore.h

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/graphics/draw/MessageRenderer.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@thebentern thebentern merged commit 96dd647 into master Apr 13, 2026
82 checks passed
thebentern added a commit that referenced this pull request Apr 14, 2026
* Fix heap blowout on TBeams

* Update src/graphics/draw/MessageRenderer.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Set MESSAGE_HISTORY_LIMIT to 10 for original ESP32 to optimize RAM usage

* Optimize message frame allocation to prevent excessive memory usage

* Refine message history limits for resource-constrained builds and cap cached lines to prevent heap overflow

* Update src/graphics/draw/MessageRenderer.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cvaldess pushed a commit to cvaldess/firmware that referenced this pull request Apr 15, 2026
* Fix heap blowout on TBeams

* Update src/graphics/draw/MessageRenderer.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Set MESSAGE_HISTORY_LIMIT to 10 for original ESP32 to optimize RAM usage

* Optimize message frame allocation to prevent excessive memory usage

* Refine message history limits for resource-constrained builds and cap cached lines to prevent heap overflow

* Update src/graphics/draw/MessageRenderer.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants