Skip to content

Update and document Emscripten link-time options - #174

Merged
mpwarres merged 7 commits into
proxy-wasm:mainfrom
mpwarres:emscripten-build-options
Mar 4, 2025
Merged

mpwarres merged 7 commits into
proxy-wasm:mainfrom
mpwarres:emscripten-build-options

Conversation

@mpwarres

@mpwarres mpwarres commented Oct 11, 2024 •

Copy link
Copy Markdown
Contributor

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]>
Comment thread bazel/defs.bzl Resolved
Comment thread bazel/defs.bzl Resolved
Comment thread bazel/defs.bzl Resolved
Comment thread bazel/defs.bzl Resolved

@martijneken martijneken left a comment

Copy link
Copy Markdown
Contributor

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

mpwarres commented Mar 3, 2025

Copy link
Copy Markdown
Contributor Author

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

Done.

PTAL again, thanks!

@mpwarres

mpwarres commented Mar 3, 2025

Copy link
Copy Markdown
Contributor Author

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

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