Edge Computing with Cloudflare Workers
We shipped FinalizationRegistry in Workers: why you should never use it

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

6/11/2025 · Ketan Gupta, Harris Hancock

What this post added

This post introduces the availability of the FinalizationRegistry API in Cloudflare Workers, a feature that allows for callbacks when JavaScript objects are garbage-collected. It details the memory management differences between JavaScript and WebAssembly, explains the inherent issues with FinalizationRegistry due to non-deterministic garbage collection, and provides guidance on its safe usage, particularly in conjunction with WebAssembly. The post also points to newer JavaScript language features as a more reliable alternative for memory management.

Read the original post ↗