Skip to content

Mat-Dialog: Possible memory leak when dialog includes textarea, input, etc. #20595

Open
@tp1906

Description

@tp1906

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/components-issue-yp5k44?file=src/app/dialog-overview-example-dialog.html

Steps to reproduce:

  1. Run application, click on open dialog button
  2. Enter text and close dialog, repeat this step.
  3. Go to Chrome Memory tab and run head snapshot. View MyDialogComponent and there are more than one instance created.
  4. Refresh chrome tab
  5. Open dialog and close without entering into text area
  6. Go to Chrome Memory tab and run head snapshot. View MyDialogComponent and there is only one instance created.

image

Expected Behavior

What behavior were you expecting to see?

I could be reading the chrome head snapshot incorrectly but I would expect there to be 1 instance of the Dialog component (MyDialogComponent) regardless if I enter something into the text-area or not.

Actual Behavior

What behavior did you actually see?

The number of instances grows by 2 each time the dialog is opened and text is entered into the text-area.

Environment

  • Angular: 10.1.0
  • CDK/Material: 10.2.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/dialogarea: material/inputperfThis issue is related to performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions