-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Can't get Rendering Assets to unload from RAM on wasm webgl2.0 build #12057
Comments
Fun fact I just learned: you can't free memory in WASM, once you allocated it you can't return it to the OS/browser 😄 See https://webassembly.github.io/spec/core/syntax/instructions.html#memory-instructions, no instruction to deallocate. Read WebAssembly/design#1397 for more details. A workaround for your usage would be to load the images one by one, and unload them before loading the next one. that way you'll need only the memory for one image |
Not much we can really do to fix this, but I'd like to add a note to the documentation for 0.13.1. |
# Objective - Fixes #12057 ## Solution - Add a note about memory management in Wasm
# Objective - Fixes #12057 ## Solution - Add a note about memory management in Wasm
Bevy version
v0.13.0
[Optional] Relevant system information
GPU: RTX 2080 Ti
Using Firefox 122 on Windows 10
(Not sure why the adapter info shows GTX 980 for firefox but problem is persistent on chrome as well)
Using Chrome shows:
What you did
I am trying to get the new "Unload Rendering Assets from RAM" feature working. I have been successful on a
local cargo run --release
build but I have not been able to replicate the memory usage on awasm
webgl
build. The attachment below shows the comparative ram usage of the local windows build and thewasm
build. For some reason thewasm
build never ends up offloading the memory and stays at the pictured amount.For reference, I am loading 63 jpg images that are on average 2MB in size and have a resolution of 2587x3375 (obviously this could be optimized and I am currently perusing a workaround of drastically decreasing their resolution)
This is the code that sets my image assets to be offloaded:
this is my build pipeline for wasm:
relevant toml:
html used to run wasm:
What went wrong
Offloading to GPU memory works on a local windows build of my application but does not happen on a wasm build of the same application.
Additional information
Memory usage:
Firefox performance graph:
The text was updated successfully, but these errors were encountered: