-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Describe the bug
3 months ago, a previously fixed memory leak in the BaseComponent of all primeng controls was reintroduced.
This leads to raising memory & degraded performance over time, especially in large applications.
Pull Request Link
Reason for not contributing a PR
- Lack of time
- Unsure how to implement the fix/feature
- Difficulty understanding the codebase
- Other
Other Reason
No response
Reproducer
https://primeng.org (can be reproduced everywhere, follow repro stept)
Environment
The (at the time of writing) latest main branch has the issue and the released v21 version aswell.
The issue was reintroduced here: 9b5c3c7#diff-315219ce5e29cd6185c317544d0a096d9f46f310d322405400a1fdd72f0737f8
Angular version
21.0.5
PrimeNG version
v21
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
The issue can be easily reproduced on the primeng docs page.
My repro steps:
- serve the app locally (for unobfuscaded code)
- open the docs at http://localhost:4200/colorpicker
- reload the page for clean memory
- open the dev tools
- navigate to the memory in dev tools and force a garbage collection
- create a heap snapshot
- in the primeng docs navigate to the datepicker section, wait until it has loaded & then navigate back to the color picker
- in the devtools force anther garbace collection
- take another heap snapshot
- compare snapshot one with two (objects allocated between snapshot 1 and snapshot 2)
- Search for "date"
The result will show 33 retained instances of the datepicker component, including their DOM nodes.
Expected behavior
With my fix, no component instances are retained anymore:

Metadata
Metadata
Assignees
Labels
Type
Projects
Status