Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptgarbage collection and leaksSingle-choice MCQ

A FinalizationRegistry callback is registered to free an off-heap resource when a wrapper object is collected. Why is it unsafe to rely on this callback running promptly, or at all?

const reg = new FinalizationRegistry((held) => freeNative(held)); reg.register(wrapper, nativeHandle);