当前位置:网站首页>JS garbage collection

JS garbage collection

2022-06-23 15:11:00 Liujiayi_

Garbage collection (GC)


- It's just like garbage will be produced when people live for a long time , Garbage will also be generated in the process of program running
After accumulating too much rubbish , Will cause the program to run too slow ,
So we need a recycling mechanism , To deal with garbage generated during program operation
- When an object does not have any variables or attributes to refer to it , At this point we will never be able to manipulate the object ,
At this time, the object is a garbage , Too many of these objects will take up a lot of memory space , Causes the program to run slowly , So this kind of garbage has to be cleaned .
- stay JS There is an automatic garbage collection mechanism in , Will automatically destroy these garbage objects from memory ,
We don't need or can't do garbage collection
- All we need to do is set objects that are no longer used null that will do

  such js Will recycle the garbage (NULL It means we don't need it anymore )

原网站

版权声明
本文为[Liujiayi_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231424014682.html