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

Plugin replace chugs a lot of memory #1064

Closed
Rigo-m opened this issue Dec 14, 2021 · 3 comments
Closed

Plugin replace chugs a lot of memory #1064

Rigo-m opened this issue Dec 14, 2021 · 3 comments

Comments

@Rigo-m
Copy link

Rigo-m commented Dec 14, 2021

Expected Behavior

Plugin replace should not, hopefully, use 3 times as much heap as without them

Actual Behavior

Running node build.js without plugin replace logs these memory readings:

Using 6.72 MB before
Using 7.36 MB after rollup
Using 8.17 MB after write

When plugin replace is activated it logs these memory readings instead:

Using 7.17 MB before
Using 26.22 MB after rollup
Using 27.43 MB after write

This is almost 3 times the heap size used without the plugin.
This became an issue while bundling a nuxt nitro application in netlify, that has 6GB hard limit on RAM usage in build containers.

@shellscape
Copy link
Collaborator

thanks for opening the issue. we'd love to see a pull request that took care of the concern and reduce the memory requirement. with the plugin working as it should without issue, and very few maintainers stepping up to work on it, it's not likely that your concern will be addressed without community support.

@Rigo-m
Copy link
Author

Rigo-m commented Dec 14, 2021

I'll see what I can do. Although I think it will become more prominent when people will start shipping nuxt nitro websites in netlify environments, since it's very easy to reach memory limits there.
Do you have any tips, on top of your head, from where to start to tackle this problem?

@Rigo-m
Copy link
Author

Rigo-m commented Dec 15, 2021

As a future reference: what makes memory go through the moon is sourceMap option of MagicString, this can be closed since every rollup plugin passes sourceMap option correctly to handle optional sourcemap generation. Hence, I will open an issue for improvement in MagicString.

@shellscape @danielroe thanks to both for the support. Have a nice day!

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

2 participants