有没有办法找到有关使用chrome dev工具发布的对象的任何信息 [英] Is there a way to find out any information about objects being released using chrome dev tools

查看:61
本文介绍了有没有办法找到有关使用chrome dev工具发布的对象的任何信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

var constructors=[];
var counter = 0;

function start() {
    for (var i=100; i> 0; i--) {
        constructors.push(new arrayValues());
    }

    if (counter < 10) {
        setTimeout(function() {
            start();
        }, 1000);
    }

    counter++;
}

function arrayValues() {
    this.values = new Array(10000000).join("x");
}

哪个将创建伪数组并导致内存泄漏.在时间轴上可以清楚地看到此模式.但我也可以看到有对象释放(标有红线).有没有办法找到有关被释放对象的任何信息,例如,何时何地创建对象等等?

Which creates dummy array and creates memory leaks. This pattern is clearly see on timeline. But I can also see that there's a release of objects (marked with red line). Is there a way to find any information about the objects being released, for example, when or where they where created, etc.?

问题不在于如何通过分析代码来查找信息,而是使用crhome-dev-tools

推荐答案

问题不在于如何通过分析代码来查找信息, 但是要使用crhome-dev-tools

The question is not how to find the information by analyzing the code, but to find it using crhome-dev-tools

如果正确解释问题,则可以使用 console.profileEnd() ; Record Heap Allocation

If interpret Question correctly, you can use console.profile(), console.profileEnd(); Record Heap Allocation

请参见

分析匿名javascript函数(chrome)

箭头函数是否像命名函数一样得到了优化?

如何是否检测到触发JavaScript中垃圾回收的内存分配?

这篇关于有没有办法找到有关使用chrome dev工具发布的对象的任何信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆