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

JavaScript heap out of memory due to memory leak #4140

Closed
zhihuahuang opened this issue Jun 15, 2021 · 4 comments · Fixed by #4142
Closed

JavaScript heap out of memory due to memory leak #4140

zhihuahuang opened this issue Jun 15, 2021 · 4 comments · Fixed by #4142

Comments

@zhihuahuang
Copy link
Contributor

  • Rollup Version: 2.15.2
  • Operating System (or Browser): any
  • Node Version (if applicable): 14
  • Link to reproduction (IMPORTANT, read below):

Expected Behavior

When rollup watch restart, the modules of last time will be released.

Actual Behavior

But it will be not. these modules are still keep by ARRAY_PROTOTYPE.
So it cause a memory leak.

I take memory snapshot before and after watch restart. Please see the picture below:

image

I read the code of ARRAY_PROTOTYPE, then find some code maybe cause memory leak.

expressionsToBeDeoptimizedByKey & thisParametersToBeDeoptimized

ARRAY_PROTOTYPE is a global variable, so the propertyexpressionsToBeDeoptimizedByKey and thisParametersToBeDeoptimized never clear.

image

image

@lukastaegert
Copy link
Member

Good catch! At the moment, these variables are actually supposed to be stateless, but as they are reusing the stateful ObjectEntity, this is obviously not the case. I will think about how to improve here, maybe an "immutable" flag for now.

@lukastaegert
Copy link
Member

Can you verify if #4142 resolves this?

@zhihuahuang
Copy link
Contributor Author

Can you verify if #4142 resolves this?

I have tried and it can resolve this problem.
Please merge the branch and publish a version quickly, thanks~

@lukastaegert
Copy link
Member

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants