Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module memory leak #322

Open
levi9311 opened this issue Jan 6, 2022 · 2 comments
Open

Module memory leak #322

levi9311 opened this issue Jan 6, 2022 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@levi9311
Copy link

levi9311 commented Jan 6, 2022

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.

@levi9311 levi9311 added the 🐞 bug Something isn't working label Jan 6, 2022
@Amanieu
Copy link

Amanieu commented Jan 6, 2022

This is fixed in Wasmer 2.1, but the Go bindings have not yet been updated to use that version.

@wouterh
Copy link

wouterh commented Mar 25, 2022

I'm also hit by this issue. Is there an ETA for updated Go bindings?

Is there something I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants