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

bun --hot always leaks memory #11083

Open
paperdave opened this issue May 15, 2024 · 0 comments
Open

bun --hot always leaks memory #11083

paperdave opened this issue May 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@paperdave
Copy link
Collaborator

What version of Bun is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

import { spawn } from "bun";
import { writeFileSync } from "node:fs";

let i = 0;
function next() {
  i++;
  writeFileSync(
    "hello.mjs",
    `// This is a medium sized testing file
// ${"contents".repeat(100)}
Bun.gc(true);
console.log('RSS in run %s is %d MB', ${i}, process.memoryUsage().rss / 1_000_000);
console.err('[done]');
`,
  );
}

next();

await using runner = spawn({
  cmd: [
    //
    process.execPath,
    "--hot",
    "run",
    "hello.mjs",
  ],
  stdio: ["ignore", "inherit", "pipe"],
  env: {
    ...process.env,
    NO_COLOR: true,
  },
});

for await (const chunk of runner.stderr) {
  if (new TextDecoder().decode(chunk).includes("[done]")) {
    next();
  }
}

What is the expected behavior?

to not leak memory

What do you see instead?

image

Additional information

No response

@paperdave paperdave added the bug Something isn't working label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant