Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Memory leak in Karma+Jasmine tests and event listeners #822

@Eddman

Description

@Eddman

I'm using @angular/material2 and it creates an event listener in a service /core/style/focus-origin-monitor.ts. The listener is bound to window (some to document as well) and it is fine for my app as Angular uses a single instance of this service.

However once I try to run my Karma test suite it generates a huge leak and chrome crashes. The problem is that whenever I create a component out of a TestBed (each spec) the listener is created and registered. It holds references to the TestBed, component, view, test data, etc.

I always thought that Zones are isolated so once I finished a spec I would expect that such listener is removed. However I've found out that listeners are registered in ProxyZoneSpec and never removed. The zone is simply set to null.

Shouldn't it remove the listeners before we run next spec? Or is it more a bug of @angular/material2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions