Pseudo Weak References for Web Content
This Ubiquity feed provides pseudo weak reference functionality to web content, for the purpose of making it easier to debug memory management issues. Specifically, it adds two new functions to the global window object of all web pages:
- PseudoWeakRef(object) is a constructor that makes a pseudo-weak reference for the object. The returned object has one method, exists(), which returns whether or not the referent still exists.
- forceGC() forces garbage collection.
Here's some example code:
The above source code is actually part of the test suite for this feed. If this feed were installed, the suite would run now.
The source code for this feed can be viewed at pseudo-weak-refs.js.