BaseComponent is causing memory leaks #17645
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
A memory leak has been occurring in BaseComponent since Primeng18, and it appears to be affecting all components that inherit from BaseComponent.
This is happening because the ThemeService being called on BaseComponent's _themeChangeListener is not being released.
Pull Request Link
#17644
Reason for not contributing a PR
Other Reason
No response
Reproducer
https://stackblitz.com/edit/promeng-memory-leak-problem?file=src%2Fmain.ts
Environment
PrimeNG 19, Angular 19
Angular version
v19.0.6
PrimeNG version
v19
Node version
v18.20.3
Browser(s)
Chrome, Edge
Steps to reproduce the behavior
This can be verified in all components using BaseComponent.
It is particularly easy to confirm when using components with virtual scrolling such as Scroller, TreeTable, and Table.
If you continue to repeatedly scroll with virtual scrolling, the project's memory usage gradually increases. Details can be confirmed by taking a heap snapshot in the browser.
Expected behavior
Ensure that ThemeService is properly handled and memory is released when the component is destroyed.
The text was updated successfully, but these errors were encountered: