logo

We shipped FinalizationRegistry in Workers: why you should never use it

ID: e38cdd7b-218c-55e4-a5bf-ce6464666bf5

STIX ID: report--e38cdd7b-218c-55e4-a5bf-ce6464666bf5

Feed Name: Cloudflare Blog

Date Published: 2025-06-11

Date Updated: 2026-04-27

Author: Ketan Gupta

...
...

Cloudflare explains the addition of FinalizationRegistry support in Workers for cleaning up WebAssembly-allocated resources, while advising against relying on it due to non-deterministic behavior and restricted I/O in finalizers. The post details JS–Wasm memory management pitfalls, the security analysis underpinning the feature’s enablement, and promotes Explicit Resource Management (using/await using with Symbol.dispose) as the preferred, deterministic approach, with FinalizationRegistry positioned as a last-resort safety net.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.