Skip to content

Commit ca80905

Browse files
committed
Address review comments
1 parent bb5f401 commit ca80905

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/content/changelog/workers/2025-04-24-finalization-registry.mdx

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Improved Memory Efficiency for WebAssembly Workers
3+
description: With the introduction of FinalizationRegistry in Workers Runtime, toolchains like Emscripten and wasm-bindgen can automatically reclaim unused WebAssembly heap and reduce memory leaks.
4+
products:
5+
- workers
6+
date: 2025-05-08T00:00:00Z
7+
---
8+
9+
[FinalizationRegistry](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry) is now available in Workers. You can opt-in using the [`enable_weak_ref`](/workers/configuration/compatibility-flags/#enable-finalizationregistry-and-weakref) compatibility flag.
10+
11+
This can reduce memory leaks when using WebAssembly-based Workers, which includes [Python Workers](/workers/languages/python/) and [Rust Workers](/workers/languages/rust/). The FinalizationRegistry works by enabling toolchains such as [Emscripten](https://emscripten.org/) and [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/) to automatically free WebAssembly heap allocations. If you are using WASM and seeing Exceeded Memory errors and cannot determine a cause using [memory profiling](/workers/observability/dev-tools/memory-usage/), you may want to enable the FinalizationRegistry.
12+
13+
For more information see the [`enable_weak_ref`](/workers/configuration/compatibility-flags/#enable-finalizationregistry-and-weakref) compatibility flag documentation.

0 commit comments

Comments
 (0)