Skip to content

[wasm] Improve handling OOM error - #104963

Merged
mkhamoyan merged 3 commits into
dotnet:mainfrom
mkhamoyan:add_log_error
Jul 17, 2024
Merged

mkhamoyan merged 3 commits into
dotnet:mainfrom
mkhamoyan:add_log_error

Conversation

@mkhamoyan

@mkhamoyan mkhamoyan commented Jul 16, 2024 •

Copy link
Copy Markdown
Contributor

By this PR in case of OOM error we will show users message to decrease EmccMaximumHeapSize.

Contributes to #84638 and #95971

@mkhamoyan mkhamoyan added the arch-wasm WebAssembly architecture label Jul 16, 2024
@mkhamoyan mkhamoyan self-assigned this Jul 16, 2024
@ghost ghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 16, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@mkhamoyan

Copy link
Copy Markdown
Contributor Author

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan

Copy link
Copy Markdown
Contributor Author

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan
mkhamoyan marked this pull request as ready for review July 16, 2024 13:05
@mkhamoyan
mkhamoyan requested review from ilonatommy and maraf July 16, 2024 13:06
Comment thread src/mono/browser/runtime/loader/run.ts Outdated
@mkhamoyan

Copy link
Copy Markdown
Contributor Author

Failures are not related.

@mkhamoyan
mkhamoyan merged commit 66ae90f into dotnet:main Jul 17, 2024
@mkhamoyan
mkhamoyan deleted the add_log_error branch July 17, 2024 14:39
Comment thread src/mono/wasm/features.md
By default the .NET runtime will reserve a small amount of memory at startup, and as your application allocates more objects the runtime will attempt to "grow" this memory. This growth operation takes time and could fail if your device's memory is limited, which would result in an application error or "tab crash".

To reduce startup time and increase the odds that your application will work on devices with limited memory, you can set an initial size for the memory allocation, based on an estimate of how much memory your application typically uses. To set an initial memory size, include an MSBuild property like `<EmccInitialHeapSize>16777216</EmccInitialHeapSize>`, where you have changed the number of bytes to an appropriate value for your application. This value must be a multiple of 16384.
To reduce startup time and increase the odds that your application will work on devices with limited memory, you can set an initial size for the memory allocation, based on an estimate of how much memory your application typically uses. To set an initial memory size, include an MSBuild property like `<EmccInitialHeapSize>16777216</EmccInitialHeapSize>`, where you have changed the number of bytes to an appropriate value for your application. This value must be a multiple of 16384. The default value is `2,147,483,648 bytes`, which may be too large and result in the app failing to start, because the browser refuses to grant it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have mixed EmccInitialHeapSize and EmccMaximumHeapSize. ~2GB is default value for EmccMaximumHeapSize, but the docs is talking about EmccInitialHeapSize. Please update it in a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for noticing, created #105068

@pavelsavara

Copy link
Copy Markdown
Member

thanks

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants