How to find JS Memory Leaks?

后端 未结 7 1646
既然无缘
既然无缘 2020-12-02 05:19

I have struggled around with the heap profiler in chrome but it is very confusing. Especially if there are minimized libraries inside. But even the DOMElements views, elemen

7条回答
  •  悲&欢浪女
    2020-12-02 05:50

    In Chrome developer tools, there is a Timeline - Memory tab:

    enter image description here

    We can watch the memory occupied by it.

    There is also Profiles - Memory, where we can take a snapshot and see what’s inside. Snapshots can be compared to each other:

    enter image description here

    Most of time, it doesn’t tell you anything. But at least you can see which objects are piling up, and probably the structure of the leak.

    Other way is using 'Task Manager' here is an article regarding this:

    http://www.javascriptkit.com/javatutors/closuresleak/

提交回复
热议问题