Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak #77

Open
pablo-mendoza opened this issue Jul 27, 2024 · 1 comment
Open

Memory leak #77

pablo-mendoza opened this issue Jul 27, 2024 · 1 comment

Comments

@pablo-mendoza
Copy link

async function test()
{
    const JSONPatcherProxy  = (await import("jsonpatcherproxy")).JSONPatcherProxy


   let gS = {
        uno: {
        },
   }

   let jsonPatcherProxy  = new JSONPatcherProxy(gS)

    let objc = jsonPatcherProxy.observe(true);

  setInterval(() => {
                let generate = jsonPatcherProxy.generate()

                console.log("Generate", generate.length)


        },500)

  setInterval(() => {
                for (let i = 0; i < 1000; i++)
                objc.uno = { test: "test" }
        },1)

}

test()

This library has a huge memory leak. Just run the above program and see memory usage increase until node is killed.

@nomeaning777
Copy link

I remember there was a memory leak in the part using Map.
It can be resolved by using WeakMap, like in this commit:
argentumcode@43f7b2b

If the maintainer is okay with it, I can create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants