Skip to content

Conversation

@Eddman
Copy link
Contributor

@Eddman Eddman commented Jun 23, 2017

Listeners created using Observable.fromEvent have to be unsubscribed to prevent memory leaks. Especially when the target is document/window.

In addition fixed a small leak in CdkMonitorFocus.

Future TODOs: few services are registering listeners on window/document (eg. FocusOriginMonitor) and theses produce huge leaks in Karma test suites. Angular creates new instances for each spec (in addition to new Zone for each spec). An issue already raised in Zone.js (angular/zone.js/issues/822) to consult what's the correct approach.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 23, 2017
@jelbourn
Copy link
Member

@Eddman can you rebase this PR?

@Eddman
Copy link
Contributor Author

Eddman commented Jun 26, 2017

@jelbourn Done.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jun 26, 2017
@tinayuangao tinayuangao merged commit 1b351cd into angular:master Jun 27, 2017
@Eddman Eddman deleted the memory_fix branch June 29, 2017 08:15
amcdnl pushed a commit to amcdnl/material2 that referenced this pull request Jul 8, 2017
…ent (angular#5325)

* Fixed memory leak in CdkMonitorFocus

* Unsubscribe events that are registered under window/document using Observable.fromEvent.

* Fixed tslint problems.
@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 Sep 6, 2019
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 PR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants