Skip to content

Commit c429bad

Browse files
authored
WASM runtime max heap size (dotnet#32257)
1 parent c527d15 commit c429bad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

aspnetcore/blazor/host-and-deploy/webassembly.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ Disable the trimming property if it prevents your app from running normally:
132132

133133
:::moniker-end
134134

135+
## Decrease maximum heap size for some mobile device browsers
136+
137+
:::moniker range=">= aspnetcore-8.0"
138+
139+
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:
140+
141+
:::moniker-end
142+
143+
:::moniker range="< aspnetcore-8.0"
144+
145+
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:
146+
147+
:::moniker-end
148+
149+
```xml
150+
<EmccMaximumHeapSize>268435456</EmccMaximumHeapSize>
151+
```
152+
153+
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).
154+
135155
:::moniker range=">= aspnetcore-6.0"
136156

137157
## Runtime relinking

0 commit comments

Comments
 (0)