A brief introduction to the js garbage collection mechanism:

Recycling strategies: reference counting and mark-and-sweep methods

 

The disadvantages of mark-and-sweep method are

 JS is single-threaded and will stop completely when encountering the garbage collection mechanism. Therefore, the browser has been optimized to achieve multi-threaded parallel recycling, but it still blocks the execution of JS. Therefore, incremental marking, segmented garbage collection, and cross execution were born. 

Guess you like

Origin blog.csdn.net/weixin_48123820/article/details/131531950