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

Make array and object prototype singletons immutable for now #4142

Merged
merged 3 commits into from Jun 17, 2021

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #4140

Description

Currently, Rollup treats the Array and Object prototypes as singletons. This is problematic as we are still using a stateful helper class to implement this, which can lead to a memory leak when used in watch mode. This hopefully improves the situation. Note that in the future, we might rework this again if we ever get to the point that we track mutations of globals.

@github-actions
Copy link

github-actions bot commented Jun 16, 2021

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#immutable-prototypes

or load it into the REPL:
https://rollupjs.org/repl/?pr=4142

@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #4142 (2eb20e0) into master (c4f9d13) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4142      +/-   ##
==========================================
+ Coverage   98.13%   98.28%   +0.15%     
==========================================
  Files         201      201              
  Lines        7116     7116              
  Branches     2083     2084       +1     
==========================================
+ Hits         6983     6994      +11     
+ Misses         64       58       -6     
+ Partials       69       64       -5     
Impacted Files Coverage Δ
src/ast/nodes/shared/ArrayPrototype.ts 100.00% <ø> (ø)
src/ast/nodes/shared/ObjectPrototype.ts 100.00% <ø> (ø)
src/ast/nodes/ArrayExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/shared/ObjectEntity.ts 100.00% <100.00%> (+4.93%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4f9d13...2eb20e0. Read the comment docs.

@lukastaegert lukastaegert merged commit aa1b227 into master Jun 17, 2021
@lukastaegert lukastaegert deleted the immutable-prototypes branch June 17, 2021 05:19
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

Successfully merging this pull request may close these issues.

JavaScript heap out of memory due to memory leak
1 participant