orca-app / orca

A Wasm environment for cross-platform, sandboxed graphical applications.
https://orca-app.dev
Other
349 stars 16 forks source link

Vector graphics samples do not render but consume tons of memory #72

Open bvisness opened 4 months ago

bvisness commented 4 months ago

On my M1 MacBook Air, the Breakout, Clock, and UI samples all present a blank screen and start using extreme amounts of real memory (growing to many gigabytes before my computer complains).

image

martinfouilleul commented 4 months ago

Fixed by ffc3c8a1.

Buffer size limits where using u32, but the webgpu implementation on M1 has a limit of 4GB (ie it overflows u32 size by one), and the oc_wgpu_canvas_encode_batch inner loop is done in such a way that we were looping indefinitely over the start of the buffer, allocating memory from the scratch arena at each iteration.

As a quick fix I changed the buffer max size computation to u64. But we should take better measures to prevent this kind of problem: