Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Downgraded Components are not garbage collectedΒ #39911

@cryve

Description

@cryve

🐞 bug report

Affected Package

The issue may be caused by package @angular/upgrade

Is this a regression?

No.

Description

I have a hybrid app consisting of a main Angular CLI app that integrates legacy AngularJS templates via custom bundling and UI-Router. When I use a downgraded Angular component in an AngularJS template and toggle the rendering of this component with ng-if, let's say 5 times, then I can find 5 instances of the component in the heap snapshot.
This doesn't happen in a pure AngularJS template nor in a pure Angular template.

πŸ”¬ Minimal Reproduction

https://github.com/cryve/angular-downgrade-memory-leak

🌍 Your Environment

Angular Version:


Angular CLI: 11.0.2
Node: 12.8.1
OS: darwin x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router, upgrade
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.2
@angular-devkit/build-angular   0.1100.2
@angular-devkit/core            11.0.2
@angular-devkit/schematics      11.0.2
@schematics/angular             11.0.2
@schematics/update              0.1100.2
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?
AngularJS code is manually bundled by this script: https://github.com/cryve/angular-downgrade-memory-leak/blob/main/ngx/build.js
The upgrade setup has been inspired by this article: https://www.angulararchitects.io/aktuelles/directly-upgrading-from-angularjs-1-x/

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: upgradeIssues related to AngularJS β†’ Angular upgrade APIsmemory leakIssue related to a memory leakstate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions