syscall/js: CopyBytesToGo increased memory allocation #47956
Labels
arch-wasm
WebAssembly issues
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-JS
Milestone
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
For the Webassembly version of Pigo face detection library I needed to transform the results returned by the
getImageData
Javascript method into aUint8Array
, which is the only value type accepted by thejs.CopyBytesToGo
function. For seamless user interaction it's requested the frame rate to be updated at a high frequency (ideally 60FPS) which cause the memory allocation to increase considerably and in the end the web browser crashes because ofOut of memory
error.This is my code:
I commented out the above code section in the hope that memory consumption will decrease, but was not the case, so I'm quite confident that this issue is related to
js.CopyBytesToGo
method.What did you expect to see?
To not crash the browser.
What did you see instead?
After a few minutes of continuous running the browser crashes.
The text was updated successfully, but these errors were encountered: