What garbage collection algorithms do all 5 major browsers use?
- by Martin Wittemann
I am currently rethinking the object dispose handling of the qooxdoo JavaScript framework.
Have a look at the following diagram (A is currently in scope):
Let's say we want to delete B. Generally, we cut all reference between all objects. This means we cut connection 1 to 5 in the example. Is this really necessary?
As far as I have read hear 1, browsers use the mark-and-sweep algorithm. In that case, we just need to cut reference 1 (connection to the scope) and 5 (connection to the DOM) which could be much faster.
But can I be sure that all browsers use the mark-and-sweep algorithm or something similar?
1 http://stackoverflow.com/questions/864516/what-is-javascript-garbage-collection