Javascript dispatchEvent上的Chrome内存泄漏
我正在使用Javascript dispatchEvent上的Chrome内存泄漏,javascript,node.js,memory-management,memory-leaks,puppeteer,Javascript,Node.js,Memory Management,Memory Leaks,Puppeteer,我正在使用puppeter和内部等待页面。evaluate(异步({我有一个循环,在每个100ms上调用函数searchList,问题是浏览器mem的使用在超过1GB的内存30分钟后不断增长 我发现是谁引起的是search.dispatchEvent行,当我对它们进行注释时,mem没有增加 我“尝试”解决它,并添加: const focusEvent = new FocusEvent('focus', { bubbles: true
puppeter
和内部等待页面。evaluate(异步({
我有一个循环,在每个100ms
上调用函数searchList
,问题是浏览器mem的使用在超过1GB的内存30分钟后不断增长
我发现是谁引起的是search.dispatchEvent
行,当我对它们进行注释时,mem没有增加
我“尝试”解决它,并添加:
const focusEvent = new FocusEvent('focus', {
bubbles: true
});
// Trigger the input value in the search box
const inputEvent = new InputEvent('input', {
bubbles: true
});
// Send enter
const keyEvent = new KeyboardEvent('keydown', {
code: 'Enter',
key: 'Enter',
keyCode: 13,
view: window,
bubbles: true
});
let search = document.querySelector('#side > div._1Ra05 > div > label > div > div._1awRl.copyable-text.selectable-text');
function searchList(name = "") {
try {
search.textContent = name;
search.dispatchEvent(focusEvent);
search.dispatchEvent(inputEvent);
search.dispatchEvent(keyEvent);
search.removeEventListener('focus', focusEvent);
search.removeEventListener('input', inputEvent);
search.removeEventListener('keydown', keyEvent);
} catch { console.log(error); };
}
但是随着时间的推移,它并没有改变任何与记忆增长有关的事情,有人知道我还能尝试停止或释放什么吗
search.removeEventListener('focus', focusEvent);
search.removeEventListener('input', inputEvent);
search.removeEventListener('keydown', keyEvent);