Closed Jns-Rs closed 1 year ago
Hey @Jns-Rs Thanks for bringing this issue upfront. We have fixed the issue and created a PR.
Please check if this fixes your issue. #401 .
Hello @sandeep-vedam
Just tested this out in our project and the issue is fixed. Thanks for the quick fix.
With the recent change introduced in 5.4.0, to reduce memory usage during app lifetime, seems to have introduced a new memory leak. The code I'm referencing to is in the
removeEventListener
function:https://github.com/rdkcentral/Lightning-SDK/blob/01e0ab82e85be1ebca701ecf281b9712a1a5394b/src/Registry/index.js#L139-L143
For example: we first add an event listener on target A and then an event listener on target B. If we then first remove the event listener on target A, it seems to also remove any references to target B and its event listeners. So when we try to remove the event listener on target B, we get an error that it cannot be found. However, the event listener itself was not removed. It looks like
splice
is removing all elements from thestartIndex
to the end of the array, which could remove references to event listeners that are still active.