【发布时间】:2016-10-31 10:41:30
【问题描述】:
我想使用 window.performance.memory 来衡量我在无头 chrome 测试中是否有任何内存泄漏。
在测试中:
beforeEach(() => {
$('body').append(initHtml);
console.log(window.performance.memory)
});
结果:MemoryInfo {}
在开发控制台中:
console.log(window.performance.memory)
结果:
MemoryInfo {totalJSHeapSize: 27600000, usedJSHeapSize: 16100000, jsHeapSizeLimit: 1530000000}
我的 Karma.conf 包含以下内容:
browsers: ['Chrome_with_memory_tests'],
customLaunchers: {
Chrome_with_memory_tests: {
base: 'Chrome',
flags: ['--enable-precise-memory-info']
}
},
有人知道为什么会这样吗?窗口对象是可用的,因为我可以在它上面运行其他方法。也许我需要另一个标志来启用这个实验性功能? https://developer.mozilla.org/en-US/docs/Web/API/Window/performance
【问题讨论】:
标签: javascript google-chrome performance-testing