Skip to content

Give PSRAM ESP32 boards without LVGL their full Python heap back - #11971

Open
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:espressif-psram-reserve-lvgl-only
Open

mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:espressif-psram-reserve-lvgl-only

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What

Hold back the PSRAM reserve only on boards that build with LVGL.

Why

Since #11887 every PSRAM board keeps a quarter of its heap from Python, even without LVGL.

Testing

Board gc.mem_free() before after
Metro ESP32-S2, 2 MB PSRAM 1,509,857 2,071,152
Metro ESP32-S3, 8 MB PSRAM 6,103,285 8,264,544

Three samples each, all identical. S2 before is 11.0.0-beta.0; S3 before is main, built from the same commit.

Boards affected (PSRAM set in mpconfigboard.mk; LVGL is on only for the P4 and S31):

Chip Boards With PSRAM, gain the heap back
ESP32-S3 120 96
ESP32-S2 56 40
ESP32 52 29
ESP32-C5 2 1
ESP32-C61 1 1
ESP32-C2, C3, C6, H2 39 0
ESP32-P4, S31 (LVGL) 7 keep the reserve

🤖 Generated with Claude Code

port_heap_get_largest_free_size() was changed to hold back a quarter of
the 8-bit heap (up to 4 MB) on every board with SPIRAM, for the LVGL
display stack. Boards without LVGL, like the Metro ESP32-S2 (2 MB PSRAM),
lost that share of gc.mem_free() and of the largest allocatable block.

Only apply the reserve when CIRCUITPY_DISPLAYIO_LVGL is enabled.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@mikeysklar
mikeysklar requested a review from a team November 26, 2026 16:30
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.

1 participant