mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
misc/wasm: free up memory on exit
Private fields of the Go class are not used any more after the program has exited. Delete them to allow JavaScript's garbage collection to clean up the WebAssembly instance. Updates #26193. Change-Id: I349784a49eaad0c22ceedd4f859df97132775537 Reviewed-on: https://go-review.googlesource.com/122296 Run-TryBot: Richard Musiol <neelance@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Paul Jolly <paul@myitcv.org.uk> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
5e70b132c2
commit
6fe7b43416
1 changed files with 5 additions and 1 deletions
|
|
@ -177,8 +177,12 @@
|
|||
go: {
|
||||
// func wasmExit(code int32)
|
||||
"runtime.wasmExit": (sp) => {
|
||||
const code = mem().getInt32(sp + 8, true);
|
||||
this.exited = true;
|
||||
this.exit(mem().getInt32(sp + 8, true));
|
||||
delete this._inst;
|
||||
delete this._values;
|
||||
delete this._refs;
|
||||
this.exit(code);
|
||||
},
|
||||
|
||||
// func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue