second-state / WasmEdge-go

The GO language SDK and API for WasmEdge
https://www.secondstate.io/articles/extend-golang-app-with-webassembly-rust/
Apache License 2.0
107 stars 16 forks source link

WasmEdge consume much more memory than Wasmer #26

Closed DarumaDocker closed 2 years ago

DarumaDocker commented 2 years ago

In this repo WasmEdge runtime for Suborbital Reactr The test will fail with the error message signal killed, which is caused by out-of-memory. To reproduce the process:

git clone https://github.com/second-state/reactr.git
cd reactr/rwasm
mkdir wt
cp ../wasmtest/swift_test.go .
cp ../wasmtest/wasm_test.go .
vi wasm_test.go

Change package of two go files to wt, then

go test
go test --tags wasmedge

go test will run with Wasmer runtime by default and with --tags wasmedge will run with WasmEdge runtime.

My host is a Ubuntu 20.04 docker container.

Below are two mem profiles of both testing on Wasmer and WasmEdge. You will notice that at the bottom of WasmEdge's graph, there is a memory consumption of 600+M more than Wasmer's graph.

wasmer suborbital-rust-test

wasmedge suborbital-rust-test

DarumaDocker commented 2 years ago

I have created a pr#27 to prevent copy data.