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

Memory leak for beforeprint and afterprint events #1212

Closed
JoostK opened this issue Feb 28, 2020 · 1 comment · Fixed by #1235
Closed

Memory leak for beforeprint and afterprint events #1212

JoostK opened this issue Feb 28, 2020 · 1 comment · Fixed by #1235
Assignees
Labels
has pr A PR has been created to address this issue
Milestone

Comments

@JoostK
Copy link
Member

JoostK commented Feb 28, 2020

Bug Report

What is the expected behavior?

Registered event handlers are unregistered on destroy to be able to free memory.

What is the current behavior?

In #1080, event handlers for the beforeprint and afterprint events are registered. These are never unregistered, which is causing unnecessary memory retention (especially in unit tests).

What are the steps to reproduce?

Include flex-layout in a project with multiple unit tests and capture a memory heap dump in Chrome Inspector. You'll find many retained tasks. Zone.js captures tasks for these events in globals on the window object:

__zone_symbol__beforeprintfalse and __zone_symbol__afterprintfalse

What is the use-case or motivation for changing an existing behavior?

In unit tests it's typical to setup and teardown an application, in which case memory from a previous run should not be retained.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Observed in [email protected] with Angular 9.0.4.

Is there anything else we should know?

CaerusKaru added a commit that referenced this issue May 7, 2020
This patches a potential memory leak in the PrintHook service
where beforeprint and afterprint events where added but never
removed.

Fixes #1212
@CaerusKaru CaerusKaru added the has pr A PR has been created to address this issue label May 7, 2020
@CaerusKaru CaerusKaru added this to the 9.0.0-beta.30 milestone May 7, 2020
@CaerusKaru CaerusKaru self-assigned this May 7, 2020
@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 Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has pr A PR has been created to address this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants