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

PyObjects are leaking memory when used in a synchronous loop #3

Open
mmomtchev opened this issue Nov 3, 2022 · 2 comments
Open

PyObjects are leaking memory when used in a synchronous loop #3

mmomtchev opened this issue Nov 3, 2022 · 2 comments

Comments

@mmomtchev
Copy link
Owner

mmomtchev commented Nov 3, 2022

This code is leaking memory:

for (let i = 0; i < 1000; i++) {
  const a = PyObject.list([1]);
  a.get('__getitem__');
}
@mmomtchev mmomtchev changed the title Method PyObject.get is leaking function descriptors PyObjects are leaking memory when used in a synchronous loop Nov 3, 2022
@mmomtchev mmomtchev added the wontfix This will not be worked on label Nov 3, 2022
@mmomtchev
Copy link
Owner Author

Alas, this is a general Node.js problem which does not have a simple solution: nodejs/node-addon-api#1140

The problem is not that serious as it might appear because:

  • Server code is never synchronous
  • Client code usually does not run forever

Still, if doing very heavy computation that requires periodic cleanup of stale objects, the two profiling targets have been transformed to async code - which completely solves this problem

mmomtchev added a commit that referenced this issue Nov 3, 2022
@mmomtchev
Copy link
Owner Author

It seems that there has been progress on this issue in Node.js but it requires that the addon explicitly supports the new code.

@mmomtchev mmomtchev removed the wontfix This will not be worked on label May 1, 2024
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