Trying to examine intricacies of JavaScript GC, I got deep into the weeds (that is, into the ECMAScript spec). It was found by me that an object should not be collected as long as it is deemed “live”. And liveness itself is defined as follows: At any point during evaluation, a set of objects S is considered live if either
Tag: garbage-collection
How to iterate over a WeakMap?
A JavaScript WeakMap does not allow you to get the key, or the length or size, by design. Is it possible to nevertheless loop over entries in some way ? If not .. how does the Chrome console do this ? Answer Is it possible to nevertheless loop over entries in some way? No, as you say, the contents of
Can Javascript objects have an “on garbage collect” callback?
I’m writing an Android app which uses Javascript in a WebView for most of the UI. I’ve exposed to JS a simple interface to create temporary files. In Java, I provide a function to create a temporary file, which returns a file ID, and a set of functions to operate on temporary files given an ID. In JS, I wrap