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(core): unsubscribe from the onError when the root view is removed #39940

Closed
wants to merge 1 commit into from
Closed

fix(core): unsubscribe from the onError when the root view is removed #39940

wants to merge 1 commit into from

Conversation

arturovt
Copy link
Contributor

@arturovt arturovt commented Dec 2, 2020

PR Checklist

PR Type

  • 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?

At the moment, when creating a root module, a subscription to the onError subject is also created. It captures the scope where NgModuleRef is created and prevents it from being garbage collected. Also note that this NgModuleRef has a reference to the root module instance (e.g. AppModule), which also prevents it from being GC'd.

Does this PR introduce a breaking change?

  • Yes
  • No

At the moment, when creating a root module, a subscription to the
`onError` subject is also created. It captures the scope where `NgModuleRef`
is created and prevents it from being garbage collected. Also note that this
`NgModuleRef` has a reference to the root module instance (e.g. `AppModule`),
which also prevents it from being GC'd.
@google-cla google-cla bot added the cla: yes label Dec 2, 2020
@pullapprove pullapprove bot requested a review from mhevery December 2, 2020 23:31
Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Nice PR @arturovt - Keep them coming!

@petebacondarwin petebacondarwin added action: presubmit The PR is in need of a google3 presubmit action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime memory leak Issue related to a memory leak target: patch This PR is targeted for the next patch release labels Dec 3, 2020
@ngbot ngbot bot modified the milestone: needsTriage Dec 3, 2020
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 3, 2020
@mhevery
Copy link
Contributor

mhevery commented Dec 3, 2020

presubmit

@mhevery mhevery closed this in 5a3a154 Dec 3, 2020
mhevery pushed a commit that referenced this pull request Dec 3, 2020
…ed (#39940)

At the moment, when creating a root module, a subscription to the
`onError` subject is also created. It captures the scope where `NgModuleRef`
is created and prevents it from being garbage collected. Also note that this
`NgModuleRef` has a reference to the root module instance (e.g. `AppModule`),
which also prevents it from being GC'd.

PR Close #39940
@arturovt arturovt deleted the unsubscribe-onerror branch December 3, 2020 21:45
@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 Jan 3, 2021
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 area: core Issues related to the framework runtime cla: yes memory leak Issue related to a memory leak target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants