Skip to content

Downgraded Components are not garbage collected #39911

Closed

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/

Activity

  1. changed the title [-]Downgraded Components are not destroyed[/-] [+]Downgraded Components are not garbage collected[/+] on Dec 1, 2020
  2. added
    area: upgrade
    on Dec 1, 2020
  3. added this to the needsTriage milestone on Dec 1, 2020
  4. added
    memory leak
    P4
    on Dec 2, 2020
  5. modified the milestones: needsTriage, Backlog on Dec 2, 2020
  6. added a commit that references this issue on Dec 8, 2020
    97310d3
  7. angular-automatic-lock-bot commented on Jan 8, 2021

    @angular-automatic-lock-bot

    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.

  8. locked and limited conversation to collaborators on Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area: upgradememory leakstate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions