Skip to content

[browser][coreCLR] reduce initial memory footprint#127905

Open
pavelsavara wants to merge 1 commit intodotnet:mainfrom
pavelsavara:INITIAL_MEMORY_STACK_SIZE_
Open

[browser][coreCLR] reduce initial memory footprint#127905
pavelsavara wants to merge 1 commit intodotnet:mainfrom
pavelsavara:INITIAL_MEMORY_STACK_SIZE_

Conversation

@pavelsavara
Copy link
Copy Markdown
Member

@pavelsavara pavelsavara commented May 7, 2026

Fixes #127880

@pavelsavara pavelsavara added this to the 11.0.0 milestone May 7, 2026
@pavelsavara pavelsavara self-assigned this May 7, 2026
Copilot AI review requested due to automatic review settings May 7, 2026 08:10
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm labels May 7, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces the default WebAssembly memory and stack settings used by the CoreCLR browser host, aiming to lower the initial memory footprint during startup (per #127880).

Changes:

  • Decrease Emscripten INITIAL_MEMORY from 128 MB to 32 MB for browserhost.
  • Decrease Emscripten STACK_SIZE from 5 MB to 2 MB for browserhost.
  • Keep the MSBuild CoreCLR WASM relink targets in sync with the browserhost CMake configuration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/native/corehost/browserhost/CMakeLists.txt Lowers default INITIAL_MEMORY and STACK_SIZE link options for the browser host to reduce startup footprint.
src/mono/browser/build/BrowserWasmApp.CoreCLR.targets Mirrors the updated memory/stack defaults in the CoreCLR WASM relink pipeline so app relinks match the host configuration.

@pavelsavara pavelsavara requested a review from radekdoulik May 7, 2026 11:32
@pavelsavara pavelsavara marked this pull request as ready for review May 7, 2026 11:32
Copy link
Copy Markdown
Member

@radekdoulik radekdoulik left a comment

Choose a reason for hiding this comment

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

LGTM, let see if CI tests will pass. Thank you!

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 7, 2026

There are more places where this is hardcoded:

src\mono\browser\browser.proj(219):<EmccStackSize>5MB</EmccStackSize>
src\mono\browser\build\BrowserWasmApp.targets(171):<EmccStackSize Condition="'$(EmccStackSize)' == ''">5MB</EmccStackSize>
src\mono\wasm\build\WasmApp.Common.targets(67):- $(EmccStackSize)                    - Stack size. Default value: 5MB.

Is this inconsistency intentional?

@pavelsavara
Copy link
Copy Markdown
Member Author

Is this inconsistency intentional?

Yes, that is Mono

@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 7, 2026

What's the reasoning behind lower limits for CoreCLR? Is there a problem with applying the same lower limits to Mono as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[browser][coreCLR] reduce INITIAL_MEMORY and STACK_SIZE

5 participants