WeakRef & GC - Interactive Lab | IconVault

Watch JavaScript garbage collection reclaim WeakRefs live, with FinalizationRegistry callbacks and real GC-trigger guidance. Free, in-browser.

All tools

WeakRef & GC

Watch garbage collection reclaim weak references live

5 of 5 free uses left

Experiment controls

5 of 5 free allocations left. Nothing leaves your browser.

How to actually trigger a GC

  1. Allocate objects, then drop strong refs.
  2. Open DevTools, Memory tab, click the trash-can (Collect garbage).
  3. Or launch Chrome with --js-flags=--expose-gc and call gc().
  4. Press "Check liveness" and watch FinalizationRegistry callbacks arrive.

JavaScript gives you no API to force collection; the GC runs on its own schedule.

0

Tracked

0

Alive

0

Reclaimed

0

Unchecked

Weak references

Nothing tracked yet. Allocate some objects and hold them with WeakRef.

FinalizationRegistry callbacks + log

Registry callbacks appear here the moment the GC reclaims an object.

About this tool

IconVault's WeakRef & GC visualizer lets you run real garbage-collection experiments: allocate objects of a chosen size, hold them only through WeakRef, and register them with a FinalizationRegistry. Drop the strong references, trigger a GC cycle, and watch liveness checks flip from alive to reclaimed while finalization callbacks stream into the log with timestamps. It is free and runs fully in your browser.

Because JavaScript exposes no API to force collection, the lab teaches the honest workflow: the DevTools Memory tab's collect-garbage button, Chrome's `--js-flags=--expose-gc` flag, and a memory-pressure button that genuinely allocates and discards large temporaries to encourage a cycle. You will see why `deref()` returning `undefined` is the only safe liveness test and why finalization callbacks must never be used for critical cleanup.

Frequently asked questions

Popular searches

weakrefweakref javascriptfinalizationregistryjavascript garbage collectionjs gc visualizerweakref derefweakref examplefinalizationregistry examplehow to trigger garbage collection javascriptgc() chrome expose-gcjavascript memory managementweak reference vs strong referenceweakmap vs weakrefwhen to use weakrefweakref cachejavascript memory leakdevtools collect garbagememory tab trash can chromejs-flags expose-gcgarbage collection visualizerv8 garbage collectormark and sweep javascriptgenerational gc v8weakref browser supportfinalizationregistry browser supportweakref typescriptderef undefinedweakref polyfilldo weakrefs prevent gccan you force gc in javascriptjavascript heapmemory pressure javascriptlarge array allocation gcfinalization callback timingweakref cleanupregistry register unregisterjavascript weak reference tutorialmdn weakrefmdn finalizationregistryes2021 weakreftarget es2021 weakrefweakref node jsfinalizationregistry nodegc performance javascriptmemory leak detection javascriptchrome memory profilerheap snapshot weakrefdoes weakref work in safariweakref memoryjavascript weak reference examplegc roots javascript

More tools

Coming soon

CLI

Coming soon

Figma plugin

Coming soon

VS Code extension

Coming soon

Chrome extension

Coming soon

AI icon generator

Coming soon

Team workspaces

Coming soon

View all 10+ tools →