-
-
Notifications
You must be signed in to change notification settings - Fork 35.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
ImageBitmapLoader: Safari has increased memory usage migrating from Three r165 to r166. #30416
Comments
Do you see an increase in memory when using a scene with a simple box geometry? So without Maybe it's because starting from |
I think you are correct, because when I use the r165 GLTFLoader with the r166 three.module.js the size matches the pure r165 example. The question now is why. Do you have any thoughts? 50M is a high price to pay, especially as I'm targeting iPhones, and I think the size difference increases with my larger models. |
I don't know why this happens. Maybe it's worth to report this issue at the Webkit bug tracker: https://bugs.webkit.org/ |
(Context for future readers: ImageBitmapLoader decompresses a texture asynchronously before upload to GPU, avoiding dropped frames during upload. Otherwise the texture is decompressed during the upload, potentially blocking the main thread and dropping frames. In either case the texture is fully decompressed on the GPU) I wonder if the difference might be that the texture object retains a reference to the uncompressed data on the main thread? Whereas that uncompressed data might only be kept on the GPU, otherwise? I'm not sure what the expected behavior is, or whether it would be different in Chrome. But perhaps one way to test this would be to delete the in-memory reference to the texture data after the first frame renders after loading the texture ( |
@stevexbritton if this might be an option for you then maybe also try optimizing and compressing your models. Just by using the model's URL from your code, I could load it in my viewer and then re-export it to GLB format with DRACO compression and WEBP textures set at max 2048 x 2048. After loading this new GLB file it showed half the memory usage in Firefox browser on Windows. You can do this yourself by loading your model into the gltf.report and then running the script and applying the compression (just change WEBP resolution to whatever works for you). Also, observe the details of re-exported model to make sure that they are good enough for your usage. EDIT: If you want then I could attach 3 different versions of your model, each with either of AVIF, KTX2 or WEBP textures. You could compare the sizes and load each one of these into the gltf.report to see their quality and memory usage. |
Description
When upgrading from Three r165 to r166 my GLB models consume approx 50MB more memory on Safari MacOS 15.1.1 and iOS 18.2. This seems like a large increase and I just wanted to check that this is to be expected. I have deliberately not used an environment map because I know they grew in size with release r161.
Reproduction steps
On MacOS
Code
Live example
https://vykingsneakerkitnative.s3.eu-central-1.amazonaws.com/SteveTest/tmp/memory-r165.html
https://vykingsneakerkitnative.s3.eu-central-1.amazonaws.com/SteveTest/tmp/memory-r166.html
Screenshots
Version
r165 & r166
Device
Desktop, Mobile
Browser
Safari
OS
MacOS, iOS
The text was updated successfully, but these errors were encountered: