"memory access out of bounds" is undefined-behavior-that-was-caught. If it happens, and you didn't write any unsafe code, there's a bug in some library — not your code. Most likely the move from #[wasm_bindgen(start)] to #[wasm_bindgen] isn't actually a problem itself — it just shuffled things around so the bug was triggered rather than not triggered, or detected rather than not detected.
I recently hit a similarly problem in my game — except the thing that changed was my workspace configuration, not any of the code within the crate. So, I suspect wasm-bindgen has a bug somewhere that we're both hitting, perhaps related to Closures. I haven't gotten around to digging into it myself, but I'd be very much interested to hear any observations you make. Just remember — when it comes to memory errors, you can't assume that just because there's no error the problem isn't present.
I can definitely say that there's no reason you have to use #[wasm_bindgen(start)] — my code doesn't use it at all.
This is likely useless for everyone else, only intention is to not incorrectly blame wasm_bindgen:
In this particular case, the problem is my fault, in the JS side, I was calling some initialization procedure twice. There may or may not be bugs in wasm_bindgen, but for this particular error, I was 100% doing something stupid / wrong on the JS side.
If you are not writing unsafe code, a memory error cannot be your code's fault. As I said before: you may have found a way to avoid triggering the bug, but there is still a bug.
That's why I'm going to, someday, spend some time to try to make a small reproduction case for the one I encountered: the way to live in a world where our code doesn't randomly fail is to chase down bugs and report them, not just dodge them.
import init, * as M from "./rust_wasm_output.js"
await init(); // first step of init
M.default(); // <-- this is not a function I wrote, but the default from importing the module; this should not be called
M.rust_gfx_loop();
I suspect I caused the same region of memory to get 'initialized twice' - or something like that; i.e. I did something that if I read the official wasm bindgen docs in detail, it would probably say : don't do this on the JS side