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(ivy): LFrame needs to release memory on leaveView() #35156

Closed
wants to merge 1 commit into from

Conversation

mhevery
Copy link
Contributor

@mhevery mhevery commented Feb 5, 2020

Root cause is that for perf reasons we cache LFrame so that we don't have to allocate it all the time. To be extra fast we clear the LFrame on enterView() rather that on leaveView(). The implication of this strategy is that the deepest LFrame will retain objects until the LFrame allocation depth matches the deepest object.

The fix is to simply clear the LFrame on leaveView() rather then on enterView()

Fix #35148

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@mhevery
Copy link
Contributor Author

mhevery commented Feb 6, 2020

presubmit

@pkozlowski-opensource pkozlowski-opensource added comp: ivy action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 6, 2020
@ngbot ngbot bot added this to the needsTriage milestone Feb 6, 2020
@mhevery
Copy link
Contributor Author

mhevery commented Feb 11, 2020

presubmit

@pullapprove pullapprove bot requested a review from kara February 11, 2020 22:01
@mhevery mhevery force-pushed the issue-35148 branch 3 times, most recently from d6fd7d5 to ceb6373 Compare February 11, 2020 23:46
@mhevery mhevery added the target: patch This PR is targeted for the next patch release label Feb 11, 2020
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

The code LGTM but I'm surprised that there is code size increase (and it is even bigger than what is written in the code as the CI check fails: https://circleci.com/gh/angular/angular/621857#tests/containers/3)

@mhevery
Copy link
Contributor Author

mhevery commented Feb 12, 2020

The code LGTM but I'm surprised that there is code size increase (and it is even bigger than what is written in the code as the CI check fails: https://circleci.com/gh/angular/angular/621857#tests/containers/3)

I think this is the case where the limit was close to 500 bytes and this CL took os over, so now you have the 500 bytes plus this CL. 226144 - 225584 = 560

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

packages/core/src/render3/state.ts Outdated Show resolved Hide resolved
packages/core/src/render3/state.ts Show resolved Hide resolved
@kara kara added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 14, 2020
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Feb 14, 2020
Root cause is that for perf reasons we cache `LFrame` so that we don't have to allocate it all the time. To be extra fast we clear the `LFrame` on `enterView()` rather that on `leaveView()`. The implication of this strategy is that the deepest `LFrame` will retain objects until the `LFrame` allocation depth matches the deepest object.

The fix is to simply clear the `LFrame` on `leaveView()` rather then on `enterView()`

Fix angular#35148
@alxhub alxhub closed this in b9b512f Feb 14, 2020
alxhub pushed a commit that referenced this pull request Feb 14, 2020
Root cause is that for perf reasons we cache `LFrame` so that we don't have to allocate it all the time. To be extra fast we clear the `LFrame` on `enterView()` rather that on `leaveView()`. The implication of this strategy is that the deepest `LFrame` will retain objects until the `LFrame` allocation depth matches the deepest object.

The fix is to simply clear the `LFrame` on `leaveView()` rather then on `enterView()`

Fix #35148

PR Close #35156
@mhevery mhevery deleted the issue-35148 branch February 14, 2020 21:29
sonukapoor pushed a commit to sonukapoor/angular that referenced this pull request Feb 17, 2020
…35156)

Root cause is that for perf reasons we cache `LFrame` so that we don't have to allocate it all the time. To be extra fast we clear the `LFrame` on `enterView()` rather that on `leaveView()`. The implication of this strategy is that the deepest `LFrame` will retain objects until the `LFrame` allocation depth matches the deepest object.

The fix is to simply clear the `LFrame` on `leaveView()` rather then on `enterView()`

Fix angular#35148

PR Close angular#35156
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ivy doesn’t deallocate memory of destroyed components correctly
4 participants