dbkaplun / driftless

Driftless setInterval and setTimeout replacement for Node and the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`timerHandles` seems to leak memory quite heavily

RobinBol opened this issue · comments

This global object gets filled but never cleared: https://github.com/dbkaplun/driftless/blob/master/src/driftless.js#L36

Using setDriftlessTimeout a lot will create a memory leak, easily and quickly reproducible:

function setTimeoutAndLog() {
    setDriftlessTimeout(() => {
        setTimeoutAndLog();
    }, 10) 
}

setTimeoutAndLog();

Screenshot 2021-11-17 at 11 20 35

I did fork and attempt to fix it here https://github.com/narze/driftless