Skip to content

Commit fcabe6f

Browse files
authored
Turn off full GC (#24545)
Using the full gc sometimes leads to an infinite recursion resulting in a browser freeze. This was noted as part of running Blazor's benchmarks. This is being addressed in rc1, in the meanwhile this reverts the behavior to 3.2 defaults. Browser freezes when using a Blazor WASM application. Yes. Full GC on is new to WASM on .NET Core Low. Off by default is the behavior we had in 3.2.
1 parent a78cd62 commit fcabe6f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Components/Web.JS/dist/Release/blazor.webassembly.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
363363
resourceLoader.purgeUnusedCacheEntriesAsync(); // Don't await - it's fine to run in background
364364

365365
MONO.mono_wasm_setenv("MONO_URI_DOTNETRELATIVEORABSOLUTE", "true");
366+
367+
// Turn off full-gc to prevent browser freezing.
368+
const mono_wasm_enable_on_demand_gc = cwrap('mono_wasm_enable_on_demand_gc', null, ['number']);
369+
mono_wasm_enable_on_demand_gc(0);
370+
366371
const load_runtime = cwrap('mono_wasm_load_runtime', null, ['string', 'number']);
367372
// -1 enables debugging with logging disabled. 0 disables debugging entirely.
368373
load_runtime(appBinDirName, hasDebuggingEnabled() ? -1 : 0);

0 commit comments

Comments
 (0)