Skip to content

v20 Accordion Functionality Memory Leak #18546

@rosenthalj

Description

@rosenthalj

Describe the bug

The v20 PrimeNG AccordionContent Component has a memory leak.

This issue was fixed in PrimeNG v19.1.3 (Closed Issue #18296), but the changes (PR #18297) never made it to v20.

The video listed below demonstrates the issue.
Video Notes:

  1. At the start of the video, I refresh the page. This clears the page's memory
  2. In the Video I navigate away from the Accordion Demo Page 5 times
  3. I use the Chrome Development Tool's Memory Profiler to take a snapshot of the browsers JavaScript VM memory (profiling type = detached elements)
  4. Chrome has detected 5 detached elements
  5. At the end of the demo I navigate to the "about page" because this is a very simple page and sometimes Chrome's Memory Profile will identify additional detached elements that would have been removed during the execution of a page's destroy methods
v20AccordionMemoryLeak.mov

See PR #18297 for a video demonstrating no memory leak, which resulted after implementing the PR #18297 fix.

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

I have not generated a PR since PR #18297 originally fixed this problem in v19.1.3 and can be used as a "suggestion" on how to fix this current memory leak.

Reproducer

https://primeng.org/accordion

Environment

N/A

Angular version

20

PrimeNG version

v19

Node version

n/a

Browser(s)

all browsers

Steps to reproduce the behavior

  1. Goto the PrimeNG Accordion Demo: https://primeng.org/accordion
  2. Refresh the page
    -- this will reset the page's memory
  3. In the demo navigate away and back to the Accordion Demo
    -- only use links provided in the PrimeNG demo to navigate
  4. Open the Chrome Development Tools and take a snapshot of detached elements
  5. There will be one "Accordion" detached node for each time you navigated way from the Accordion Demo page

Expected behavior

No detached nodes
No memory leak

Metadata

Metadata

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions