FlexGrid - proper disposal and possible detached DOM element leaks

Posted by: mark.brodziak on 19 February 2024, 2:32 pm EST

  • Posted 19 February 2024, 2:32 pm EST

    We are using FlexGrid with Angular 17, and we’re experiencing detached DOM elements after navigating away from the grid to other parts of the application. These are causing memory leaks for us.

    Our integration is quite complex and there are a lot of moving parts. We have found and fixed several points of listener registration that was resulting in object retainers preventing GC. This has made things a bit better but hasn’t solved the fundamental issue.

    I’ve taken a step back to try and produce a more minimal example, and this example itself seems to produce a bunch of detached DOM nodes, quite possibly because I am doing the wrong thing or because I am missing steps in proper disposal.

    Here is the example: https://jscodemine.mescius.io/sample/IakIcWjo_UWakAgvpJEDFA/

    What I have found in our integration is that there are some hanging listeners that appear to be created by Wijmo and that are not disposed. In particular there seems to be a ‘load’ listener attached to the window that is never removed, but I don’t really know what is going on here. We also seem to have hanging listeners for ‘keydown’, ‘keypress’, ‘compositionstart’ and ‘compositionend’.

    Can you provide any advice or insight into what might be going on here and what we should be doing to properly dispose of the grid? Are there any listener deregistration bugs within Wijmo itself that might be contributing to our headaches?

    Thank you in advance.

  • Posted 19 February 2024, 11:14 pm EST

    Hi,

    Thank you for sharing the sample. I was able to replicate the issue regarding “load” event and the listeners being left after disposing the FlexGrid. I have informed the same to the DEV team for further investigation. Please note the internal tracking id for further communication on this issue: WJM-33468.

    However, I was not able to replicate the same for the keypress, compositionstart and compositionend event. Please let me know if I need to follow certain steps to replicate the issue with them.

    Thank you.

    Regards

  • Posted 20 February 2024, 12:31 pm EST

    Thanks for the confirmation.

    If the team is able to advise us of any workarounds (or, in lieu of this, a nightly build that we can integrate with), we’d very much appreciate it. This ‘load’ listener appears to be the retainer that is holding open a lot of elements from garbage collection, and it is causing us significant pain at the moment.

    Thanks again.

  • Posted 20 February 2024, 10:07 pm EST

    Hi Mark,

    This issue is currently escalated to the DEV team. I have asked the DEV team for investigating the feasibility of providing the fix of this issue in the nightly along with any better workarounds. I will update you as soon as I will get any information from the concerned team.

    Thank you for your patience.

    Regards

  • Posted 22 February 2024, 2:12 pm EST

    Thanks Anirudh,

    I’m afraid there might be another listener leak in addition to the “load” listener. I’m seeing a “keydown” listener when I activate tooltips in my grid. Can you please have the team check into this one as well?

  • Posted 22 February 2024, 8:33 pm EST

    Hi Mark,

    I have asked the DEV team to look into this issue while considering all the events form which the listeners are not removed even after using the dispose() method.

    Thank you.

    Regards

  • Posted 25 February 2024, 3:14 pm EST

    Thanks Anriudh,

    We have reviewed the aforementioned event listener leak for ‘keydown’, ‘keypress’, ‘compositionstart’, and ‘compositionend’. Steps to reproduce this are at:

    https://jscodemine.mescius.io/sample/atRsCYFL_kmZ5raCt12Atg/

    Hope this helps.

  • Posted 25 February 2024, 10:17 pm EST

    Hi Mark,

    Thank you for sharing this sample.

    As informed earlier the concern for memory leak regarding these events and some other events are already conveyed to the DEV team. I will update you if I get any updates from the concerned team.

    Thank you for your understanding and patience.

    Regards.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels