Skip to content

Node.js leaks memory when creating classes in a loop. #22229

Closed
@hashseed

Description

@hashseed

Steps to reproduce:

$ cat test.js
'use strict';
for (var i = 0;; ++i) {
  if (i % 100 == 0) gc();
  new class{};
}

$ node --expose-gc test.js & top -p $! && kill -9 $!  # use q to quit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    perf_hooksIssues and PRs related to the implementation of the Performance Timing API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions