feat(websocket): add PSRAM allocation options - #1117
Open
gabsuren wants to merge 1 commit into
Open
Conversation
gabsuren
force-pushed
the
pr-980-fix
branch
2 times, most recently
from
July 30, 2026 08:07
3ec0aff to
1132650
Compare
gabsuren
force-pushed
the
pr-980-fix
branch
2 times, most recently
from
July 30, 2026 10:23
846f197 to
5d6b0ca
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5d6b0ca. Configure here.
Add Kconfig options for PSRAM allocations in esp_websocket_client, including external-memory task stack gating with FREERTOS_TASK_CREATE_ALLOW_EXT_MEM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add Kconfig options for PSRAM allocations in esp_websocket_client, including external-memory task stack gating with FREERTOS_TASK_CREATE_ALLOW_EXT_MEM.
Related
This PR builds on #980 and simplifies the external task-stack implementation.
Note
Medium Risk
PSRAM task stacks impose cache-disabled constraints on WebSocket task and event-handler code; misconfiguration can cause subtle runtime faults, though options are off by default and failures fail closed without internal-RAM fallback.
Overview
Adds optional PSRAM placement for
esp_websocket_clientto reduce internal RAM use on SPIRAM-enabled builds.ESP_WS_CLIENT_ALLOC_IN_EXT_RAMmoves the main client object and itswebsocket_config_storage_tto PSRAM viaheap_caps_calloc/heap_caps_free(no fallback—esp_websocket_client_init()returns NULL on failure). Other allocations (strings, RX/TX buffers, transports, mutexes, etc.) stay on internal RAM.ESP_WS_CLIENT_TASK_STACK_IN_EXT_RAMcreates the WebSocket worker withxTaskCreatePinnedToCoreWithCaps()so only the stack lives in PSRAM (TCB stays internal). The task exits withvTaskDeleteWithCaps(NULL); this path requires ESP-IDF ≥ 5.3.1 (compile-time#errorotherwise). Failed stack allocation makesesp_websocket_client_start()returnESP_FAIL. Kconfig documents cache-off restrictions for code running on that task (including event handlers).Reviewed by Cursor Bugbot for commit 2512950. Bugbot is set up for automated code reviews on this repo. Configure here.