简体   繁体   中英

Which modern browsers use Mark and Sweep Algorithm for Garbage Collection?

While going through garbage collection, I came across Reference Counting and Mark & Sweep GC Algorithms.
Some research on the web says that Reference Counting is a thing of the past and most of the browsers today have adapted Mark and Sweep. As per the article here

Since 2012, JavaScript Engine’s have adapted this algorithm over Reference-counting garbage collection.

While I haven't found any standard documentation for the same, I am curioud to know following:

  1. Was there any other reason other than cyclic dependency that made us move away from Reference Counting and adopt Mark & Sweep?
  2. Do all modern browsers (Chrome | Firefox | Safari | Edge | IE) use Mark and Sweep?

Quoting MDN

As of 2012, all modern browsers ship a mark-and-sweep garbage-collector. All improvements made in the field of JavaScript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation improvements of this algorithm, but not improvements over the garbage collection algorithm itself nor its reduction of the definition of when "an object is no longer needed".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM