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

Invoke async method on remote object got by remote.getGlobal causes memory leak. #135

Open
imndx opened this issue Jul 3, 2022 · 0 comments

Comments

@imndx
Copy link

imndx commented Jul 3, 2022

The following is the test case.

In the test case, after the callback has been called, the arrow function keep been strongly referenced by the remote module,and cannot be gc collected.

// main process

global.foo = {bar: {
        testCallback(cb){
            cb && cb('testCallback');
        }
    }};
// renderer process

let bar = remote.getGlobal('foo').bar;

// create a big array, to make monitor the memory leak easily
let willLeakArray = [];
for (let i = 0; i < 1024 * 1024 * 10; i++) {
    willLeakArray.push('' + i);
}
bar.testCallback((value)=> {
    console.log('testCallback', value, willLeakArray.length ); 
})
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

1 participant