While the existing answers gave solutions to solve the problem, and in the second half of the question they do not answer the question about self-detection of the first half of the question, which is in bold: "How can I see which variable is the reason Overhead of memory ...? "
It might not have been so cool 3 years ago, but now the Chrome Devevloper Tools Profiles section has become quite powerful and feature rich. The chrome team has an insightful article on how to use it and therefore, just like garbage collection (GC) works in javascript, which underlies this question.
Since delete is basically the root of Yohai Akoki's currently accepted answer, it is important to remember what deletion does. It does not matter if you do not combine with the concepts of how the GC works in the following two answers: if an existing object reference exists, it is not cleared. The answers are more correct, but probably not so rated, because they require more attention than just writing "delete." Yes, one of the possible solutions could be to use delete, but it doesn't matter if there is another link to a memory leak.
delicateLatticeworkFever appropriately mentions circular references, and the chrome command documentation can provide much greater clarity, as well as tools for checking the cause.
Since deletion was mentioned here, it may also be useful to provide an Understanding Delete resource. but it does NOT get into any actual solution that is really related to js GC.
Shwaydogg Oct 16 '15 at 17:47 2015-10-16 17:47
source share