bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.66k stars 3.52k forks source link

Add an example demonstrating how to load your assets sequentially to reduce memory usage on web platforms #12653

Open alice-i-cecile opened 6 months ago

alice-i-cecile commented 6 months ago

What problem does this solve or what need does it fill?

On WASM, memory cannot be reclaimed / freed. As a result, loading all of your assets up front in a loading-screen pattern will balloon your memory usage and it will never go back down. See https://github.com/bevyengine/bevy/issues/12057 for more context.

What solution would you like?

Add an example demonstrating how to load assets one at a time, and then moving them onto the GPU using RenderAssetUsage once loaded.

Explain why this is useful for web.

What alternative(s) have you considered?

We could make this the default behavior on wasm.

Additional context

This came up when helping a commercial user debug performance issues on iOS.

alice-i-cecile commented 4 months ago

Upstream issue discussing WASM's memory limitations: https://github.com/WebAssembly/design/issues/1397