Describe the bug
The Datepicker component has a memory leak due to Renderer2 listeners that are create twice without properly disposing both.
Listeners are being created in constructor and on ngOnInit() over the same variable, which makes it twice per component display (i.e. every time you enter to a screen containing it) and destroyed on ngOnDestroy(), which only takes care of the later (the ones from constructor are in "limbo").
To Reproduce
Steps to reproduce the behavior:
Create a screen with the datepicker (or multiple to go faster)
Go in an out of the screen several times
Wait for garbage collector
Verify that not all memory has been recovered, thus leaking
Expected behavior
Should not leak memory
Additional context
I have reproduced this in version 14.3.0 but this happens since the beginning of the library and still present in latest version.
I will fix it for versions 14.x -> 17.x on several PRs.
Describe the bug The Datepicker component has a memory leak due to Renderer2 listeners that are create twice without properly disposing both. Listeners are being created in constructor and on ngOnInit() over the same variable, which makes it twice per component display (i.e. every time you enter to a screen containing it) and destroyed on ngOnDestroy(), which only takes care of the later (the ones from constructor are in "limbo").
To Reproduce Steps to reproduce the behavior:
Expected behavior Should not leak memory
Additional context I have reproduced this in version 14.3.0 but this happens since the beginning of the library and still present in latest version. I will fix it for versions 14.x -> 17.x on several PRs.