Skip to content

[v1] StyleStore leaks memory #6646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ej612 opened this issue Nov 22, 2024 · 1 comment · Fixed by #6649
Closed

[v1] StyleStore leaks memory #6646

ej612 opened this issue Nov 22, 2024 · 1 comment · Fixed by #6649
Labels

Comments

@ej612
Copy link
Contributor

ej612 commented Nov 22, 2024

Describe the bug

Hi there,

My sincere apologies for bugging you with an issue with v1, but we're still stuck on it unfortunately.

I'm in the process of updating our project from 1.26.2 to 1.29.13 and I can't get our test suite to pass since Chrome crashes due to running out of memory (Chrome seems to have a hardcoded memory cap at 4.4GB). I have managed to track the issue down to the cleanup function of @ui5/webcomponents-react-base/dist/stores/StyleStore:

function subscribe(listener) {
    const listeners = getListeners();
    STORE_LOCATION[getStyleStoreListenersSymbol()] = [...listeners, listener];
    return () => {
        // vvvvv
        STORE_LOCATION[getStyleStoreListenersSymbol()] = listeners.filter((l) => l !== listener);
        // ^^^^^
    };
}

It seems like listeners is not properly torn down and leftover listeners accumulate over time:
image

Here's the corresponding entry in the JS heap snapshot:
image

I seem to have managed to make the tests pass by changing the cleanup to:

STORE_LOCATION[getStyleStoreListenersSymbol()] = [];

But I don't know if this is too brusque.

Thanks a lot in advance!

UI5 Web Components for React Version

1.29.13

UI5 Web Components Version

1.24.13

Browser

Chrome

@ui5-webcomponents-react-bot
Copy link
Contributor

🎉 This issue has been resolved in version v2.5.0 🎉

The release is available on v2.5.0

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants