script: Correctly handle Reflector with AssociatedMemory and remove associated memory in finalize instead of drop#42271
Merged
jdm merged 2 commits intoservo:mainfrom Feb 1, 2026
Merged
Conversation
Signed-off-by: sagudev <[email protected]>
This only matters for nested/inherited structs, where we do not want for parent to do release. Signed-off-by: sagudev <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reviewable per commits:
As noted in #42180 (comment) transmuting
&Reflector<AssociatedMemory>to&Reflector<()>will ignore AssociatedMemory information and thus it will not remove extra associated memory. By returning&Reflector<Self::ReflectorType>fromDomObject::reflector()we will preserve this information and thus correctly handle cases with associated memory. We also do not needoverrideMemoryUsagein bindings.conf anymore. 🎉Instead of removing associated memory in drop code we should do it as part of finalizers, otherwise we have problems in nested (inherited) structs, where drop is run for both parent and child, but we only added associated memory for child (on init_reflector) which already included size of parent. The only exception here is promise, because it is RCed and not finalized.
Testing: Tested locally that it fixes speedometer.
Fixes #42269