-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[bugfix] Avoid memory leak in updateLocale #4561
Conversation
This looks good. Can we add a test that shows it fixes a potential memory leak? |
src/lib/locale/locales.js
Outdated
|
||
if (locales[name] != null && locales[name].parentLocale != null) { | ||
// Update existing child locale in-place to avoid memory-leaks | ||
locales[name].set(config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this require the config provided to updateLocale
to be a complete config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See, for example, #4438
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question... just because it doesn't break current unit-tests doesn't mean it's any good :-/
It probably needs to be slightly more hideous, like:
locales[name].set(mergeConfigs(locales[name]._config, config));
I'll try that when I get a chance.
@ashsearle great. Could we add some tests to show that this change won't memory leak? |
Any updates @ashsearle ? |
Not really. It should be trivial to use leakage to wrap one of the updateLocale tests and check for memory leaks. But... I'm just wasting time fighting moment's rollup config and getting nowhere (I cannot figure out how to refer to any package installed in node_modules.) |
Merged in ccd55f9 |
[bugfix] Avoid memory leak in updateLocale
Fixed #4476