Skip to content

SourceTextModule memory leak #33439

Closed
Closed
@grosto

Description

@grosto
  • Version: v14.2.0
  • Platform: Darwin Kernel Version 19.4.0
  • Subsystem: vm

What steps will reproduce the bug?

run this snippet with --experimental-vm-modules

const {SourceTextModule} = require('vm');

let grow = () => {
  new SourceTextModule(`1 + 1`);
  setTimeout(grow, 100)
}

grow()

How often does it reproduce? Is there a required condition?

Reproducible on every run on my machine.

What is the expected behavior?

SourceTextModule should be cleaned up by GC

What do you see instead?

The SourceTextModule instances never get cleaned up.
image

Additional information

I think issue is that ModuleWrap is used as a key in WeakMap in vm module, but I am not really familiar with this codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions