-
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
Node.js leaks memory when creating classes in a loop. #22229
Comments
Thanks for filing this issue. Just a small correction (to avoid possible confusion): |
Yes, you are right. I fixed the test. |
Any chance the RSS increase is caused by running the GC, rather than the (edit: confirmed.) |
This could do the trick here: diff --git a/src/node_perf.cc b/src/node_perf.cc
index 5a50223ed593..8aad8ca1a705 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -272,6 +272,8 @@ void MarkGarbageCollectionEnd(Isolate* isolate,
v8::GCCallbackFlags flags,
void* data) {
Environment* env = static_cast<Environment*>(data);
+ if (!env->performance_state()->observers[NODE_PERFORMANCE_ENTRY_TYPE_GC])
+ return;
GCPerformanceEntry* entry =
new GCPerformanceEntry(env,
static_cast<PerformanceGCKind>(type), |
That might be right :) |
I'll open PR |
Steps to reproduce:
Observe reserved memory slowly grow. This will eventually cause out-of-memory.
This was first observed here. Note that this does not reproduce with d8 (V8's test shell), where the memory use stabilizes fairly quickly.
The text was updated successfully, but these errors were encountered: