Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Go Webassembly抛出-内存访问超出范围_Go_Memory Management_Webassembly - Fatal编程技术网

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

Go Webassembly抛出-内存访问超出范围,go,memory-management,webassembly,Go,Memory Management,Webassembly,我遵循了blog.gopheracademy.com/address-2017/go-wasm上的教程,从golang语言生成.wasm文件 我在执行程序时遇到了以下错误 /home/user/test>节点wasm\u exec.js test.wasm 有时也会出现以下错误 运行时:操作系统[0x30000000,0x938AB2FD3400000]分配的内存不可用 在可用地址空间中:在可用地址空间外结束 致命错误: 内存保留超出地址空间限制 我使用了这个程序的默认WebAssembly.M

我遵循了blog.gopheracademy.com/address-2017/go-wasm上的教程,从golang语言生成.wasm文件

我在执行程序时遇到了以下错误

/home/user/test>节点wasm\u exec.js test.wasm

有时也会出现以下错误

运行时:操作系统[0x30000000,0x938AB2FD3400000]分配的内存不可用 在可用地址空间中:在可用地址空间外结束

致命错误: 内存保留超出地址空间限制

我使用了这个程序的默认WebAssembly.Memory(默认内存约为1033MB)


这里有什么我遗漏的吗?

您可以运行此示例:(您将需要Go 1.11beta1).这两个示例之间有什么区别?我浏览了这个包,但没有发现上一个示例中的任何内容?你能解释一下吗?你尝试过的教程来自wasm作为受支持的Go平台登陆之前。如果你安装了go1.11beta1或更高版本,你可以更轻松地运行我指出的示例。或者e互联网,如下所示:
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)
    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);
            });