-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
v8.serialize leaks memory #40828
Labels
v8 module
Issues and PRs related to the "v8" subsystem.
Comments
It doesn't look like you're giving the garbage collector a chance to run. Does the memory get collected once the loop is exited? |
I still see memory surging when I invoke const { serialize } = require("v8");
const { memoryUsage } = process;
for (let i = 0; i < 1 << 22; i++) {
serialize({});
if (i % (1 << 15) === 0) {
gc();
console.log(
`RSS: ${Math.round((memoryUsage().rss / 1024 / 1024) * 100) / 100} MiB`
);
}
} |
Same issue observed on various x86 CPUs and node 16.x and 17x. The issue doesn't seem to occur on my M1 though. |
liuxingbaoyu
added a commit
to liuxingbaoyu/node
that referenced
this issue
Apr 11, 2022
When Buffer::New passes in existing data, it cannot be garbage collected in js synchronous execution. Fixes: nodejs#40828 Refs: nodejs#38300
liuxingbaoyu
added a commit
to liuxingbaoyu/node
that referenced
this issue
Apr 11, 2022
When Buffer::New passes in existing data, it cannot be garbage collected in js synchronous execution. Fixes: nodejs#40828 Refs: nodejs#38300
guangwong
pushed a commit
to noslate-project/node
that referenced
this issue
Oct 10, 2022
When Buffer::New passes in existing data, it cannot be garbage collected in js synchronous execution. Fixes: nodejs/node#40828 Refs: nodejs/node#38300 PR-URL: nodejs/node#42695 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v17.0.1
Platform
21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64
Subsystem
v8
What steps will reproduce the bug?
Run the following snippet
How often does it reproduce? Is there a required condition?
Must reproduce
What is the expected behavior?
The RSS in the stdout should converges to some tens of MiB. For example, if
v8.serialize
is replaced byJSON.stringify
, the RSS is stablized at 33.89MiB.What do you see instead?
The RSS keeps rising indefinitely.
Additional information
Also affected: v16.0.0
Additional context: babel/babel#13970
The text was updated successfully, but these errors were encountered: