-
Notifications
You must be signed in to change notification settings - Fork 59
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
fix: Potential memory leak issues in node #368
base: main
Are you sure you want to change the base?
Conversation
I really need it, can anyone take a look at it? Thanks! |
I modified my test script because I got from @napi-rs/napi-rs#613 that GC might not be triggered correctly. After a long period of running, the memory has stabilized after a small increase.
|
Thanks for your contribution, but I'm afraid this doesn't address the problem at its source. The right way is to use a sensible I have a PR for this, but haven't had time to continue developing it. |
@yisibl 这里的核心问题是泄漏的内存是堆外内存,RSS 的增长不会触发 JS 的 GC(也可能是 Node 的 bug,参考:napi-rs/napi-rs#613 ),通过 ObjectFinalize 手动释放不会生效。感觉手动 Free 可能是最优解了 😂 |
这里的代码片段不会触发 Node 的这个 GC 问题, 应该是有别的泄漏原因 |
Adding this code is very effective in node. maybe fix #216
Before:
After:
When running for a long time, it will have a small increase and then become stable. This may depend on the size of the default value of the resvg construction when it is released. I have not found a way to completely release the memory held by rust, but for most scenarios, this increase should be negligible. At present, this code seems to work well.