Ir para conteúdo

c7aesa7r

Members
  • Total de itens

    1
  • Registro em

  • Última visita

Reputação

0 Comum

Sobre c7aesa7r

  1. c7aesa7r

    Chrome memory leak on dispatchEvent

    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); }; } I'm using `puppeteer` and inside await page.evaluate(async ({ I have a loop that calls the function searchList on each `100 ms`, the problem is the browser memory usage is growing constantly, after 30min its over 1GB of ram. I discovered that whos causing it is the `search.dispatchEvent` lines, when i comment they, the memory does not increase. I "tried" to solve it adding: ``` search.removeEventListener('focus', focusEvent); search.removeEventListener('input', inputEvent); search.removeEventListener('keydown', keyEvent); ``` But it did not change anything in relation to the mem increasing over time, does someone have any idea what else i could try to stop or release the mem growing? Obs: Copiei meu post do stackoverflow por isso está em ingles, se alguém poder ajudar agradeço.
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.