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

Fix memory leak via oldProps #1549

Merged
merged 1 commit into from Mar 19, 2018
Merged

Fix memory leak via oldProps #1549

merged 1 commit into from Mar 19, 2018

Conversation

Pessimistress
Copy link
Collaborator

For #1548

Change List

  • reset layer.oldProps once update is complete

Tests: node, browser, layer-browser

@@ -449,6 +443,8 @@ export default class Layer {
}

this.clearChangeFlags();
// Release old props for GC once update is complete
this.oldProps = EMPTY_PROPS;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, do we actually need to store them on the layer? If we keep them around and trigger another diff, we'll get incorrect results, so we might as well not store them at all? Is there any other reason to keep them around?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layerManager assigns oldProps outside of the layer, which is later used by shouldUpdateState and updateState. For minimum change we have to keep the field around.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it should not be necessary.

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, lets get this in but start working on getting rid of oldProps completely.

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

Successfully merging this pull request may close these issues.

None yet

3 participants