Skip to content

[Bug]: memory leak problem #5120

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

Open
karlsbeard opened this issue Apr 27, 2025 · 5 comments
Open

[Bug]: memory leak problem #5120

karlsbeard opened this issue Apr 27, 2025 · 5 comments
Assignees

Comments

@karlsbeard
Copy link

Version

System:
    OS: macOS 13.5
    CPU: (10) x64 Apple M2 Pro
    Memory: 23.32 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 16.6
  npmPackages:
    @rsbuild/core: ^1.3.9 => 1.3.9

Details

When saving Vue or config files in the project using cmd+s, Rsbuild restarts and subsequently increases the memory usage of the rsbuild-node process. This memory increase is significant and correlates with the size of the project. For instance, with an initial project size of approximately 1.9GB, each save operation typically results in an additional 0.5GB of memory usage. This issue is particularly severe, as it can lead to insufficient memory on my development machine after just 15 saves, severely impacting the development experience.

Steps to Reproduce

  1. Open the project in a code editor (e.g., Cursor, because I found this problem in Cursor).
  2. Make changes to any Vue or config file within the project.(Actually no file changed is also ok to review this problem)
  3. Save the file using cmd+s.
  4. Observe the memory usage of the rsbuild-node process in the Activity Monitor or using the top command in the terminal.
  5. Repeat steps 2-3 multiple times and monitor the memory usage.

Expected Behavior
The memory usage of the rsbuild-node process should remain stable and not increase significantly with each save operation. (I try vite or webpack and found it will not increase the memory usage)

Image

Reproduce link

https://github.com/karlsbeard/rsbuld-memory-leak#

Reproduce Steps

  1. run pnpm i
  2. run pnpm dev
  3. go into anyone vue page or rsbuild.config.ts file
  4. open the activity monitor in mac os
  5. view the rsbuild-node memory usage which link to the demo repo
@chenjiahan
Copy link
Member

@quininer cc~

@quininer
Copy link

I believe we have recently fixed part of this issue (web-infra-dev/rspack@6362a79 and web-infra-dev/rspack@d71a6ab), and I will continue to investigate the remaining memory growth causes.

@karlsbeard
Copy link
Author

I believe we have recently fixed part of this issue (web-infra-dev/rspack@6362a79 and web-infra-dev/rspack@d71a6ab), and I will continue to investigate the remaining memory growth causes.

Thanks a lot.

@karlsbeard
Copy link
Author

I believe we have recently fixed part of this issue (web-infra-dev/rspack@6362a79 and web-infra-dev/rspack@d71a6ab), and I will continue to investigate the remaining memory growth causes.

"What's more, I found that version 1.3.9 performs better than version 1.1.6 or other versions in terms of memory leak issues, so I believe we have partially fixed this problem. However, the memory leak problem still remains, and I hope we can fix it as soon as possible.

I also want to ask about another issue: the memory usage of rsbuild should increase and then decrease later. Is this the expected behavior? In the 0.x versions, I observed that memory usage increases when I press Cmd+S(save) on any file, and it decreases later, but the overall trend shows an increase."

@quininer
Copy link

quininer commented Apr 28, 2025

the memory usage of rsbuild should increase and then decrease later

I think this is because of the behavior of mimalloc , which doesn't return memory immediately. and some objects are held by js, which will also cause this behavior.

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

3 participants