简体   繁体   English

分析 Chrome 浏览器中的应用程序 memory 泄漏

[英]Analyzing application memory leak in Chrome browser

I have web application running in chrome browser.我在 Chrome 浏览器中运行了 web 应用程序。 When I ran for long time I can see increase in memory footprint and java script memory.当我长时间运行时,我可以看到 memory 占用空间和 java 脚本 memory 的增加。 My application is switching screen from one page to another page and back to initial page every 15 seconds.我的应用程序每 15 秒将屏幕从一个页面切换到另一个页面并返回到初始页面。 How do start analysis?如何开始分析?

When you talk about memory leaks in JS, it may be due to an unintentional global variables, persistant closures or detached DOM nodes which are still referenced.当您谈论 JS 中的 memory 泄漏时,可能是由于无意的全局变量、持久闭包或仍被引用的分离的 DOM 节点。

There are few tools in DevTools which you can use to detect the above cases. DevTools 中很少有工具可以用来检测上述情况。

  1. You can use a Heap Snapshot and see the allocations to which you have direct references from the code.您可以使用堆快照并查看您从代码中直接引用的分配。

  2. You can use the Allocation Timeline to link the heap snapshot information to a timeline and let you see where the memory is allocated.您可以使用分配时间线将堆快照信息链接到时间线,并让您查看 memory 的分配位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM