Skip to content

Make the engine's static limits overridable from the build - #1

Merged
truedat101 merged 1 commit into
mainfrom
configurable-limits
Sep 24, 2026
Merged

truedat101 merged 1 commit into
mainfrom
configurable-limits

Conversation

@truedat101

Copy link
Copy Markdown
Contributor

Wrap MAX_STACK, MAX_RSTACK, MAX_WORD_LEN, MAX_WORDS, MAX_INPUT and MAX_DICT_CODE in #ifndef so a consumer can size the dictionary, code space and stacks with -D flags. Defaults are unchanged.

Motivation: on an ESP32-S3 without PSRAM the default arrays cost ~57 KB of internal RAM, which does not fit beside a TLS stack. With -DMAX_WORDS=160 -DMAX_WORD_LEN=24 -DMAX_DICT_CODE=1536 the engine takes ~14 KB (measured in the Diana Cardputer host project).

Verified: esp32c3_release with defaults (66,928 B RAM, 177,724 B flash, unchanged) and esp32s3_release with the reduced limits (28,948 B RAM).

Wrap MAX_STACK, MAX_RSTACK, MAX_WORD_LEN, MAX_WORDS, MAX_INPUT and
MAX_DICT_CODE in #ifndef so a consumer can size the dictionary, code
space and stacks with -D flags. Defaults are unchanged.

Motivation: on an ESP32-S3 without PSRAM the default arrays cost ~57 KB
of internal RAM, which does not fit beside a TLS stack. With
-DMAX_WORDS=160 -DMAX_WORD_LEN=24 -DMAX_DICT_CODE=1536 the engine takes
~14 KB (measured in the Diana Cardputer host project).

Verified: esp32c3_release with defaults (66,928 B RAM, 177,724 B flash,
unchanged) and esp32s3_release with the reduced limits (28,948 B RAM).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@truedat101
truedat101 merged commit 8651fcc into main Sep 24, 2026
6 checks passed
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