systelab / systelab-components

Systelab Angular common components
MIT License
14 stars 8 forks source link

Memory Leak on Datepicker component #846

Closed Blackvals closed 5 months ago

Blackvals commented 5 months ago

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:

  1. Create a screen with the datepicker (or multiple to go faster)
  2. Go in an out of the screen several times
  3. Wait for garbage collector
  4. 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.

Blackvals commented 5 months ago

Related PRs:

Blackvals commented 5 months ago

Closed after addressing the problem in versions 14 to 17 (see related PRs above) and generating new versions for each