-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 memory usage for environment map manager #12370
Conversation
Thank you for the pull request, @ggetz! ✅ We can confirm we have a CLA on file for you. |
@ggetz when I load the Unit box sandcastle locally and change from |
pixelFormat: PixelFormat.RGBA, | ||
}); | ||
manager._irradianceMapTexture = texture; | ||
if (defined(texture)) { |
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.
Should this be checking isDestroyed()
first? Some places in this PR you do and some you don't. One of these might be the cause of the error I mentioned above.
Also worth noting that this is exactly why I had questions about this pattern #12266
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.
Throughout this class, I've looked to set any destroyed property back to undefined
to avoid the need for the check.
I think #12266 is still worth considering, but I think for the purposed of this PR and to keep the scope small I'd like to avoid addressing it here.
I will also note that I do see a pretty significant reduction in memory used on my system as a whole when loading the 100 models example from the forum thread locally |
As a response to #12320 (comment) : In that issue, I said "I'll probably try again", so I just tried out the current And now I tried out this branch, and there, I could not cause that crash. So the main issue seems to be fixed. I also saw the I did not fully think through the code changes. But it seems like to combination of the reduced number of And... since "Testing software" should usually not mean "Checking that it works" but rather "Trying to break it", here's a small outtake from that: |
@jjhembd or @lukemckinstry, could one of you take a final review pass and merge if happy? I think it'd be helpful to get this into main soon given the holidays. |
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.
Test cases look much improved, and I agree with the logic of the fix 👍
Description
Changes include:
Issue number and link
Addresses #12356
Testing plan
I found it really helpful to use this webgl memory tool for testing. Thanks to @javagl for pointing it out!
Texture memory results
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change