You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every time the pymport module is loaded and then unloaded, it leaks about 15Kb to 20Kb of memory.
The only way this can happen more than once is if the main thread never loads the module but repeatedly spawns worker_threads that load the module and then quit, allowing Node.js to unload the library.
The text was updated successfully, but these errors were encountered:
This is in fact a Python problem, Py_Finalize being a best-effort API call. In particular, the initialization of the Python GC and some singletons is not reversible.
The best work-around when spawning temporary worker_threads that use pymport is to always load pymport from the main thread before using it in the worker_threads - this way Node.js won't be able to unload it when the worker_thread quits.
Not only this will solve the memory leaks, but it will vastly improve the performance as loading Python is quite expensive.
Every time the
pymport
module is loaded and then unloaded, it leaks about 15Kb to 20Kb of memory.The only way this can happen more than once is if the main thread never loads the module but repeatedly spawns
worker_threads
that load the module and then quit, allowing Node.js to unload the library.The text was updated successfully, but these errors were encountered: