rollup / rollup

Next-generation ES module bundler
https://rollupjs.org
Other
25.28k stars 1.5k forks source link

Memory grow with rollup 3.19 #4904

Closed Mister-Hope closed 1 year ago

Mister-Hope commented 1 year ago

Rollup Version

3.19.1

Operating System (or Browser)

Ubuntu 22.04 (WSL)

Node Version (if applicable)

18.15.0

Link To Reproduction

https://github.com/vuepress-theme-hope/vuepress-theme-hope/pull/2906

(https://github.com/vuepress-theme-hope/vuepress-theme-hope/commit/f1beda027224e3fcdf8c191bf2e564577e8eae67 is working fine)

Expected Behaviour

I am expecting Rollup can build.

All project using vite (which relies on rollup) run out of memory

I believe rollup have memory leak because webpack actually takes more memory comparing with vite, but all vite ci blows with rollup changing from 3.18.0 to 3.19.1.

If rollup itself runs well all time, perhaps vite can not handle rollup change? Anyway, I hope someone can check why the memory is increasing in my case (At least > 300MB with the version change)

Actual Behaviour

Run out of memory.

kachurun commented 1 year ago

I have the same issue with 3.18

Screenshot 2023-03-15 at 14 18 06

My build accidentally fails sometimes because node process out of memory (2gb). For sure I can increase limit for node, but I didn't have any problems until update to v3 branch.

lukastaegert commented 1 year ago

There was additional analysis added in 3.19.0 that might explain a moderate increase in memory consumption.

Mister-Hope commented 1 year ago

There was additional analysis added in 3.19.0 that might explain a moderate increase in memory consumption.

Thanks for the reply, but I think the additional analysis take no less than 15% extra memory. Can we get a chance to see if we can optimize it? I am kind of disappointed whenI found out 2GB is not enough for my “demo projects”

cpauwels commented 1 year ago

I also have what I believe is a related issue with building all my Nuxt projects (Related issue: https://github.com/unjs/nitro/issues/1063)

lukastaegert commented 1 year ago

A maximum call stack exceeded error looks like an actual bug in Rollup. If we can have a reproduction for the issue, even a complicated one, then I can have a look.

warflash commented 1 year ago

Hey @lukastaegert in case you're still looking for a reproduction there's this issue over on nuxt https://github.com/nuxt/nuxt/issues/19824 containing a repro + CI logs

lukastaegert commented 1 year ago

I am looking for a reproduction for “Maximum call stack size exceeded”, not “JavaScript heap out of memory”. Those are very different problems.

RadiumAg commented 1 year ago

Me too, I restore to "rollup 3.10.0" that resolve this problems

hi-reeve commented 1 year ago

does this solved with the latest version?

kalvenschraut commented 1 year ago

https://github.com/nuxt/nuxt/issues/19783#issuecomment-1494464055 @lukastaegert

Looks like a nuxt user was able to figure out a repo in his comment for the callstack error. Found it after digging into myself why I was getting this issue and seems to point to rollup 3.19 as with rollup at 3.18, my build succeeds with no error.

Darkmift commented 1 year ago

I believe I am experiening a similar/related issue

sharing this log in hope it might help my build fails and trying rn to reproduce witha blank project...will update this message asap

Edit:

The issue is NOT RELATED TO ROLLUP!

I had an issue with another library (@vueuse/core) where useTimeago caused it....instead using formattedtimeago. hope my suffering will help others :)

Maximum call stack size exceeded
error during build:
RangeError: Maximum call stack size exceeded
    at ObjectEntity.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:6043:43)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8597:36)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8973:15)
    at ParameterVariable.addEntityToBeDeoptimized (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8589:45)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8973:15)
    at ParameterVariable.addEntityToBeDeoptimized (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8589:45)
    at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:8973:15)
    at ParameterVariable.addEntityToBeDeoptimized (file:///***/client/node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
danielroe commented 1 year ago

From what I can tell, the issue seems to be caused by https://github.com/rollup/rollup/pull/4892.

Here are two stackblitzes:

You can update the resolution to just 3.19.0 to reproduce the issue, if that's helpful to narrow down the issue.

RadiumAg commented 1 year ago

From what I can tell, the issue seems to be caused by #4892.

Here are two stackblitzes:

You can update the resolution to just 3.19.0 to reproduce the issue, if that's helpful to narrow down the issue.

yes, you are right

lukastaegert commented 1 year ago

I created #4938 to improve the situation, feedback welcome.

rollup-bot commented 1 year ago

This issue has been resolved via #4938 as part of rollup@3.20.3-0. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.20.3-0 or npm install rollup@beta. It will likely become part of a regular release later.

rollup-bot commented 1 year ago

This issue has been resolved via #4938 as part of rollup@3.20.3. You can test it via npm install rollup.