Skip to content

Plugin reload leaks ESM module graphs for the process lifetime #920

Closed

Description

@SawyerHood

Split out from #919 (plugin reload for path installs).

bb plugin reload / bb plugin watch invalidate a mutable plugin tree by stamping a per-root epoch onto every module URL under that root. This works, but Node never releases ESM module records, so each reload retains another module graph until the process exits.

Measured during review of #919: a 500-reload probe retained roughly 57 MiB after garbage collection.

This is inherent to any URL-keyed ESM reload boundary — there is no way to release the old graph. Bounding it requires a genuinely different isolation boundary, most likely a worker or a vm realm per plugin, which changes the plugin execution model. That was well beyond the scope of the bug fix in #919, where the prior behavior was that reload silently did not work at all.

Scope of impact today: dev iteration only (path: installs and source-layout builtins). Managed git:/npm: artifacts are immutable after promotion and are not re-keyed.

Worth doing if plugin dev sessions turn out to run long enough for this to bite.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions