dousuiben8395 2018-07-18 11:43
浏览 1447

Webassembly抛出-内存访问超出范围

I have followed the tutorial on blog.gopheracademy.com/advent-2017/go-wasm for generating the .wasm file from golang language.

I faced the below error when I execute the program,

/home/user/test > node wasm_exec.js test.wasm

RuntimeError: memory access out of bounds
    at memchr (wasm-function[75]:96)
    at internal_bytealg.IndexByteString (wasm-function[72]:24)
    at runtime.findnull (wasm-function[683]:227)
    at runtime.gostring (wasm-function[678]:126)
    at runtime.goenvs_unix (wasm-function[604]:639)
    at runtime.goenvs (wasm-function[432]:86)
    at runtime.schedinit (wasm-function[498]:780)
    at runtime.rt0_go (wasm-function[860]:165)
    at _rt0_wasm_js (wasm-function[907]:71)
    at global.Go.run (/home/user/test/wasm_exec.js:378:24)

Sometimes getting the below error too,

runtime: memory allocated by OS [0x30000000, 0x938ab2fd34000000) not in usable address space: end outside usable address space

fatal error: memory reservation exceeds address space limit

I have used the default WebAssembly.Memory of this program (default memory is around 1033MB).

    WebAssembly.instantiate(fs.readFileSync("test.wasm"), go.importObject).then((result) => {
process.on("exit", () => { // Node.js exits if no callback is pending
                    if (!go.exited) {
                        console.error("error: all goroutines asleep and no JavaScript callback pending - deadlock!");
                        process.exit(1);
                    }
                });
                result.instance.exports.run()
                return go.run(result.instance);
            }).catch((err) => {
                console.error(err);
                go.exited = true;
                process.exit(1);
            });

Is anything I missed here?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 有没有帮写代码做实验仿真的
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
    • ¥20 yolov5自定义Prune报错,如何解决?