Skip to content

Arduino_H7_Video: stop reallocating rotate buffer on every redraw#1115

Open
spielp wants to merge 1 commit into
arduino:mainfrom
spielp:fix/h7video-rotate-buffer-realloc-churn
Open

Arduino_H7_Video: stop reallocating rotate buffer on every redraw#1115
spielp wants to merge 1 commit into
arduino:mainfrom
spielp:fix/h7video-rotate-buffer-realloc-churn

Conversation

@spielp

@spielp spielp commented Jun 30, 2026

Copy link
Copy Markdown

When the display is configured for rotation, lvgl_displayFlushing() reallocated rotated_buf to wh4 bytes on every flush, i.e. on every screen redraw. Because the dirty-area size varies frame to frame, this churned the heap continuously and could fragment it until the allocation failed mid-draw, crashing under sustained redrawing (e.g. on the Giga Display Shield). The result was also assigned straight back into rotated_buf, leaking the old block and dereferencing NULL on failure.

Grow the buffer only when a larger area arrives and converge to the max chunk size.

When the display is configured for rotation, lvgl_displayFlushing() reallocated rotated_buf to w*h*4 bytes on every flush, i.e. on every screen redraw.
Because the dirty-area size varies frame to frame, this churned the heap continuously and could fragment it until the allocation failed mid-draw,
crashing under sustained redrawing (e.g. on the Giga Display Shield). The result was also assigned straight back into rotated_buf,
leaking the old block and dereferencing NULL on failure.

Grow the buffer only when a larger area arrives and converge to the max chunk size.
@CLAassistant

CLAassistant commented Jun 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants