wasmer-go
wasmer-go copied to clipboard
Module memory leak
Thanks for the bug report!
Describe the bug
I think there might be a memory leak when creating a module.
When I create a module in an endless loop, the memory usage as is shown by free command on Linux increases endlessly.
Steps to reproduce
Here is the code.
package main
import (
"io/ioutil"
"runtime"
"time"
"github.com/wasmerio/wasmer-go/wasmer"
)
func main() {
wasmBytes, _ := ioutil.ReadFile("./demo.wasm")
go func() {
for {
time.Sleep(time.Second)
runtime.GC()
}
}()
for {
engine := wasmer.NewEngine()
store := wasmer.NewStore(engine)
module, _ := wasmer.NewModule(store, wasmBytes)
module.Close()
store.Close()
}
}
Expected behavior
I expect the memory usage is under a stable number.
Actual behavior
Memory usage keeps increasing.
This is fixed in Wasmer 2.1, but the Go bindings have not yet been updated to use that version.
I'm also hit by this issue. Is there an ETA for updated Go bindings?
Is there something I can do to help?