Skip to content

v21 DynamicDialog Memory Leak #19227

@rosenthalj

Description

@rosenthalj

Describe the bug

Dynamic Dialog has a memory leak.

The video listed below demonstrates the issue with Dynamic Dialog memory leak.
Video Notes:

  1. At the start of the video, I hard refresh the page. This clears the page's memory
  2. I go to the Dynamic Dialog Demo Page
  3. I open and close the Dynamic Dialog multiple times
  4. I navigate from the Dynamic Dialog page to the "about page" because "about page" is a very simple page
  5. I use the Chrome Development Tool's Memory Profiler to take a snapshot of the browsers JavaScript VM memory (profiling type = detached elements)
  6. Chrome has multiple detached Dynamic Dialog elements
bugDynamicDialogMemoryLeak.mov

Examining the source code, it appears that the memory leak is caused because the DynamicDialog component is incorrectly overriding the ngOnDestroy method.

Image

Pull Request Link

#19228

Reproducer

https://primeng.org/dynamicdialog

Environment

n/a

Angular version

21+

PrimeNG version

v21

Node version

n/a

Browser(s)

all browsers

Steps to reproduce the behavior

Repeat the steps in the video above

Expected behavior

no memory leak

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIssue contains a bug related to a specific component. Something about the component is not working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions