Skip to content
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

pluginData memory leak #3825

Closed
TomokiMiyauci opened this issue Jul 7, 2024 · 1 comment
Closed

pluginData memory leak #3825

TomokiMiyauci opened this issue Jul 7, 2024 · 1 comment

Comments

@TomokiMiyauci
Copy link

When pluginData was specified, memory usage increased with each rebuild.

main.mjs

import { context } from "esbuild";

const namespace = "testing";

const ctx = await context({
   stdin: {
    contents: `import "testing";`,
  },
  plugins: [
    {
      name: "testing",
      setup(build) {
        build.onResolve({ filter: /^testing$/ }, () => {
          return { path: "testing", namespace, pluginData: { value: "test" } };
        });

        build.onLoad({ filter: /.*/, namespace }, (args) => {
          return { contents: "console.log(0);" };
        });
      },
    },
  ],
  write: false,
  format: "esm",
  bundle: true,
});

setInterval(async () => {
  await ctx.rebuild();
}, 100);

If you run this, you will observe the Object usage increasing over time.

node --inspect main.mjs

The following images show a comparison of snapshots at two points in time:

memory-leak
@TomokiMiyauci
Copy link
Author

Tried with esbuild@0.23.0

@evanw evanw closed this as completed in a15bb51 Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant