Home > Web Front-end > JS Tutorial > body text

A brief discussion on the memory leak problem caused by js closure_javascript skills

WBOY
Release: 2016-05-16 15:53:38
Original
1449 people have browsed it

In js closures, "local variables" can be defined, but calling them externally, especially repeated assignment calls, will cause a lot of memory overhead. How to prevent this phenomenon from happening? Are there any similar memory or efficiency issues to be aware of regarding closures? How to avoid it?

Memory problems may be caused by the following reasons:
1. Circular reference causes memory leak
2. Memory leak caused by external function call

Avoid memory leaks

1. Break circular references
2. Add another closure
3. Avoid closure itself

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template