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
fix: ensure external memory adjustments are balanced #33266
fix: ensure external memory adjustments are balanced #33266
Conversation
Release Notes Persisted
|
I was unable to backport this PR to "15-x-y" cleanly; |
I was unable to backport this PR to "16-x-y" cleanly; |
I have automatically backported this PR to "18-x-y", please check out #33305 |
I have automatically backported this PR to "17-x-y", please check out #33306 |
@dsanders11 has manually backported this PR to "15-x-y", please check out #33311 |
@dsanders11 has manually backported this PR to "16-x-y", please check out #33312 |
Description of Change
This change is modeled after how it is done for
ImageBitmap
in Chromium.The current code has the potential to make unbalanced adjustments, decrementing more memory than it has incremented, which messes with the overall tracking. Currently adding a representation to an empty
nativeImage
doesn't increase the external memory count, but the destructor decrements it, leading to a net negative. If you run that in a loop, you'll eventually turn the total external allocated memory count negative.I think there are improvements to be made on the general tracking here, especially with multiple representations, but that requires more research and I wanted to start by fixing the bug here which can impact the total external allocated memory count.
cc @miniak
Checklist
npm test
passesRelease Notes
Notes: Fixed incorrect external memory allocation tracking in nativeImage module