What is the purpose of FinalizationRegistry and what guarantees does the spec make about when callbacks fire?

JavaScript Professional Hard

JavaScript Professional — Hard

What is the purpose of FinalizationRegistry and what guarantees does the spec make about when callbacks fire?

Key points

  • FinalizationRegistry registers cleanup callbacks post-GC
  • Spec does not ensure timing or callback execution
  • Callback may or may not be called after object is collected

Ready to go further?

Related questions