Closed egol closed 8 months ago
Chrome memory usage:
Apologies for randomly closing and reopening this issue as I was unsure of if this is a browser or bevy related bug.
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 https://github.com/WebAssembly/design/issues/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.
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: