-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
GLTFLoader parser.associations refactor #25252
Comments
I don't think I see what makes this a breaking change, wouldn't the API be the same, and the contents of the association would be a superset of what it is now? /cc @drcmda in case this affects R3F or gltfjsx |
Well, it's a breaking change for me because I was looping through the keys of the |
I'm a bit too busy now and haven't deeply thought yet but changing |
Sounds good to me as well. 👍🏻 |
PRs would still be welcome, but no current plans to implement this. |
Description
<model-viewer>
has two open issues that trace back to errors inparser.associations
: google/model-viewer#3287 (comment), and google/model-viewer#4029The second turns out to be caused by
ReduceAssociations()
being called for multiple scenes, which was introduced here to handle a memory leak: #22583. I believe these kinds of errors will keep cropping up unless we can simplify the associations.Solution
I think a better approach for avoiding memory leaks would be to make the
associations
into aWeakMap
instead of aMap
. Then we could removeReduceAssociations()
entirely and not worry about having entries for extra clones. This is a breaking change and I'll have to refactor MV a bit for it, but sinceassociations
isn't documented I think @takahirox is the main other user of it, so I'm mostly looking for his opinion. @donmccurdy, hopefully you'll appreciate the simplification here.Alternatives
Just fix these bugs in place, but I fear the code will get even more convoluted and will continue to be prone to memory leaks.
Additional context
No response
The text was updated successfully, but these errors were encountered: