wasm - Browser gets stuck due memory usage

146 views
Skip to first unread message

mihai barbulescu

unread,
Nov 10, 2019, 5:12:14 AM11/10/19
to golang-nuts
I'm trying to build a web/client app using Go (compiled to wasm). The issue is that the browser(both FF and Chrome) gets stuck(i.e and I get a notice "A page is slowing your browser | Stop it | Wait" ) shortly after some minimal interaction (initial page is loaded and a form is processed).
I took a Memory sample using firefox developer tools(see the print-screen) but I can't find what exactly the culprit. Any idea what could cause it or  how to better debug it? Most of the memory seems to go into runtime.ScheduleTimeoutEvent.
The program is built using Go tip.

Elias Naur

unread,
Nov 10, 2019, 5:55:11 AM11/10/19
to golang-nuts
Possible duplicate of https://github.com/golang/go/issues/35111 (garbage collection of js.Value references)
which was recently fixed.

Please try with gotip (https://godoc.org/golang.org/dl/gotip) or build from source. Note that the fix for #35111
made js.Value equality tests a compile time error, so you might need to update your code to use the new
IsNull, IsUndefined, Equal, IsNaN.

-- elias

mihai barbulescu

unread,
Nov 10, 2019, 6:12:12 AM11/10/19
to golang-nuts
It seems in the end the issue was actually a deadlock in the event loop. I fixed it by  spawning go routines on all the functions interacting with the dom.

-------------------------------
Reply all
Reply to author
Forward
0 new messages