简体   繁体   English

如今,借助Chrome开发工具可以解决内存泄漏问题

[英]Isolating memory leaks with Chrome Dev Tools nowadays

The other day I was trying to use the famous three-snapshot-technique as described by Addy Osmani in this post . 前几天,我试图使用Addy Osmani在这篇文章中描述的著名的三幅快照技术。 Not that I suspect to have any but as a normal precaution I tend to look for them before launching a new application. 并不是说我怀疑有任何东西,但是作为一种正常的预防措施,我倾向于在启动新应用程序之前先寻找它们。 I've used this multiple times without any issues. 我已经使用了多次,没有任何问题。

However, in latest versions of Chrome, it seems the comparison view between heap allocations is no longer possible so you can't see what's retained between them that's causing the leak. 但是,在最新版本的Chrome中,似乎不再可能进行堆分配之间的比较视图,因此您看不到它们之间保留的哪些内容导致了泄漏。

Attaching one screenshot from the quoted article and one screenshot from my machine. 附上引用的文章的一个屏幕截图和我的机器的一个屏幕截图。

Allocation comparison 分配比较

在此处输入图片说明

No allocation comparison :( 没有分配比较:(

在此处输入图片说明

Chrome version is latest stable for Mac which is "36.0.1985.143" at the time of writing. Chrome版本是Mac的最新稳定版本,在撰写本文时为“ 36.0.1985.143”。 I've also tried Canary and it doesn't work. 我也尝试过Canary,但它不起作用。

Any ideas of what's the approach nowadays with the changed Chrome? 关于改变后的Chrome如今采取什么方法的任何想法?

You need to select the Take Heap Snapshot checkbox, not Record Heap Allocations. 您需要选择“获取堆快照”复选框,而不是“记录堆分配”。 You can then choose Comparison to choose between shapshots to compare. 然后,您可以选择“比较”以在要比较的快照之间进行选择。

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

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