WASM runtime max heap size (#32257)

pull/32259/head
Luke Latham 2024-04-05 19:34:56 -04:00 committed by GitHub
parent c527d153e9
commit c429badd47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -132,6 +132,26 @@ Disable the trimming property if it prevents your app from running normally:
:::moniker-end
## Decrease maximum heap size for some mobile device browsers
:::moniker range=">= aspnetcore-8.0"
When building a Blazor app that runs on the client (`.Client` project of a Blazor Web App or standalone Blazor WebAssembly app) and targets mobile device browsers, especially Safari on iOS, decreasing the maximum memory for the app with the MSBuild property `EmccMaximumHeapSize` may be required. The default value is 2,147,483,648 bytes, which may be too large and result in the app crashing if the app attempts to allocate more memory with the browser failing to grant it. The following example sets the value to 268,435,456 bytes in the `Program` file:
:::moniker-end
:::moniker range="< aspnetcore-8.0"
When building a Blazor WebAssembly app that targets mobile device browsers, especially Safari on iOS, decreasing the maximum memory for the app with the MSBuild property `EmccMaximumHeapSize` may be required. The default value is 2,147,483,648 bytes, which may be too large and result in the app crashing if the app attempts to allocate more memory with the browser failing to grant it. The following example sets the value to 268,435,456 bytes in the `Program` file:
:::moniker-end
```xml
<EmccMaximumHeapSize>268435456</EmccMaximumHeapSize>
```
For more information on [Mono](https://github.com/mono/mono)/WebAssembly MSBuild properties and targets, see [`WasmApp.Common.targets` (`dotnet/runtime` GitHub repository)](https://github.com/dotnet/runtime/blob/main/src/mono/wasm/build/WasmApp.Common.targets).
:::moniker range=">= aspnetcore-6.0"
## Runtime relinking