JavaScript can also leak memory

I haven't had time to write. I originally wanted to write it at night, but I had other problems at night.
Let's write briefly first. Using the memory of chrome's devTools, I found that the memory keeps increasing. After checking the function, I found that my front-end colleagues used an array to store events that had not been processed in time. These events had references to downloaded data (there was always downloading, and the volume was large), and then after the event was processed, the event was not removed from the array. Clear, there are references that prevent the GC from reclaiming this part of the memory, causing a memory leak. Even the memory explosion affects the user experience.
JS also has memory leak problems. When storing things in an array, remember to delete it after use!

Supongo que te gusta

Origin blog.csdn.net/ZhaoBuDaoFangXia/article/details/83756537
Recomendado
Clasificación