Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and document Emscripten link-time options #174

Merged
merged 7 commits into from
Mar 4, 2025

Conversation

mpwarres
Copy link
Contributor

@mpwarres mpwarres commented Oct 11, 2024

Set INITIAL_HEAP=64KB and ALLOW_MEMORY_GROWTH=1 to reduce starting memory usage of plugins, but allow the heap to grow. Use default Emscripten STACK_SIZE of 64KB, see this emscripten-discuss thread for background behind that value.

Also add comments documenting the purpose of each link-time option.

Set INITIAL_HEAP=1MB and ALLOW_MEMORY_GROWTH=1 to reduce starting memory usage
of plugins, but allow the heap to grow. Explicitly set STACK_SIZE (previously
named TOTAL_STACK) to 1MiB. This is a middle ground between Emscripten's
default value prior to 3.1.27 of 5MiB and its default value since then of
64KiB.

Also add comments documenting the purpose of each link-time option.

Signed-off-by: Michael Warres <[email protected]>
Copy link
Contributor

@martijneken martijneken left a comment

Choose a reason for hiding this comment

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

Let's move this PR forward? Please add the same link-time options to the Makefile:

em++ --no-entry -sSTANDALONE_WASM -sEXPORTED_FUNCTIONS=_malloc \

mpwarres added 2 commits March 3, 2025 05:24
- Reduce STACK_SIZE to 256KB
- Update Makefile to be in sync with Bazel build rule

Signed-off-by: Michael Warres <[email protected]>
@mpwarres
Copy link
Contributor Author

mpwarres commented Mar 3, 2025

Let's move this PR forward? Please add the same link-time options to the Makefile:

Done.

PTAL again, thanks!

mpwarres added 3 commits March 3, 2025 20:52
- Remove STACK_SIZE override, and instead use Emscripten default of 64KB
- Change INITIAL_HEAP to 64KB

Signed-off-by: Michael Warres <[email protected]>
@mpwarres
Copy link
Contributor Author

mpwarres commented Mar 3, 2025

Updated to remove the explicit settings of STACK_SIZE (so default 64KB is used), and reduce INITIAL_HEAP to 64KB. PTAL again, thanks!

@mpwarres mpwarres merged commit 7465dee into proxy-wasm:main Mar 4, 2025
4 checks passed
@mpwarres mpwarres deleted the emscripten-build-options branch March 4, 2025 00:33
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.

5 participants